e860ed96f32ea7806889100414d820c20beba833.svn-base 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button v-if="isRoleEdit" class="success" @click="handleCreate">新增</el-button>
  5. <el-button v-if="isRoleEdit" class="danger" @click="handleDelete">删除</el-button>
  6. <el-button class="success" @click="handleFeedBank">饲料库</el-button>
  7. </div>
  8. <div class="search">
  9. <el-input v-model="table.getdataListParm.parammaps.fname" placeholder="饲料名称" style="width: 130px;" class="filter-item" clearable />
  10. <el-select v-model="table.getdataListParm.parammaps.fclassid" filterable placeholder="饲料类别" class="filter-item" style="width: 150px;" clearable>
  11. <el-option v-for="item in feedTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
  12. </el-select>
  13. <el-select v-model="table.getdataListParm.parammaps.source" filterable placeholder="饲料来源" class="filter-item" style="width: 120px;" clearable>
  14. <el-option v-for="item in feedSourcesList" :key="item.id" :label="item.name" :value="item.id" />
  15. </el-select>
  16. <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>
  17. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  18. </el-select>
  19. <div ref="selectInput" class="filter-item selectInput">
  20. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  21. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  22. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  23. <ul v-if="arrowUp" class="selectUl">
  24. <li><a>允许误差数</a><el-input v-model="table.getdataListParm.parammaps.allowratio"type="text" style="width: 245px;" /></li>
  25. <li><a>跳转重量域</a><el-input v-model="table.getdataListParm.parammaps.autozone" type="text" style="width: 245px;" /></li>
  26. <li>
  27. <a>跳转延时</a>
  28. <el-select v-model="table.getdataListParm.parammaps.autosecond" filterable placeholder="跳转延时" class="filter-item" style="width: 245px;" clearable>
  29. <el-option v-for="item in jumpDelayList" :key="item.value" :label="item.label" :value="item.value" />
  30. </el-select>
  31. </li>
  32. <li>
  33. <div style="float: right;">
  34. <el-button class="minCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  35. <el-button class="miniSuccess" @click="handleSearch">搜索</el-button>
  36. </div>
  37. </li>
  38. </ul>
  39. </div>
  40. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  41. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  42. </div>
  43. <div class="table">
  44. <el-table
  45. :key="table.tableKey"
  46. v-loading="table.listLoading"
  47. element-loading-text="给我一点时间"
  48. :data="table.list"
  49. border
  50. fit
  51. highlight-current-row
  52. style="width: 100%;"
  53. :row-style="rowStyle"
  54. :cell-style="cellStyle"
  55. class="elTable table-fixed"
  56. @selection-change="handleSelectionChange"
  57. >
  58. <el-table-column type="selection" align="center" width="50" />
  59. <el-table-column label="序号" align="center" type="index" width="50px">
  60. <template slot-scope="scope">
  61. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="饲料名称" min-width="130px" align="center">
  65. <template slot-scope="scope">
  66. <span>{{ scope.row.fname }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="饲料分类" min-width="130px" align="center">
  70. <template slot-scope="scope">
  71. <span>{{ scope.row.fclass }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="唯一编码" min-width="110px" align="center">
  75. <template slot-scope="scope">
  76. <span>{{ scope.row.feedcode }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="饲料来源" min-width="110px" align="center">
  80. <template slot-scope="scope">
  81. <span>{{ scope.row.source }}</span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="计划类型" min-width="110px" align="center">
  85. <template slot-scope="scope">
  86. <span>{{ scope.row.printgroup }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="允许误差数(kg)" min-width="110px" align="center">
  90. <template slot-scope="scope">
  91. <span>{{ scope.row.allowratio }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="包装单位重量(kg)" min-width="110px" align="center">
  95. <template slot-scope="scope">
  96. <span>{{ scope.row.unitweight }}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="单价" min-width="110px" align="center">
  100. <template slot-scope="scope">
  101. <span>{{ scope.row.uprice }}</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="跳转重量域(kg)" min-width="110px" align="center">
  105. <template slot-scope="scope">
  106. <span>{{ scope.row.autozone }}</span>
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="跳转延时" min-width="110px" align="center">
  110. <template slot-scope="scope">
  111. <span>{{ scope.row.autosecondname }}</span>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="确认开始" min-width="110px" align="center">
  115. <template slot-scope="scope">
  116. <span>{{ scope.row.confirmstartname }}</span>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="继电器位置" min-width="110px" align="center">
  120. <template slot-scope="scope">
  121. <span>{{ scope.row.trgaddress }}</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="备用字段01" min-width="110px" align="center">
  125. <template slot-scope="scope">
  126. <span>{{ scope.row.backup1 }}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="备用字段02" min-width="110px" align="center">
  130. <template slot-scope="scope">
  131. <span>{{ scope.row.backup2 }}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="备用字段03" min-width="110px" align="center">
  135. <template slot-scope="scope">
  136. <span>{{ scope.row.backup3 }}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="是否启用" min-width="110px" align="center">
  140. <template slot-scope="scope">
  141. <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="操作" align="center" width="320" class-name="small-padding fixed-width" fixed="right">
  145. <template slot-scope="{row}">
  146. <el-button class="miniSuccess" @click="handleNutritive (row)">营养价值</el-button>
  147. <el-button v-if="isRoleEdit" class="miniSuccess" @click="handleRelation(row)">关联</el-button>
  148. <el-button v-if="isRoleEdit" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  149. <el-button v-if="isRoleEdit" class="miniDanger" @click="handleRowDelete(row)">删除</el-button>
  150. </template>
  151. </el-table-column>
  152. </el-table>
  153. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  154. </div>
  155. <!-- 新增/编辑 -->
  156. <el-dialog :title="textMap[create.dialogStatus]" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="90%">
  157. <div class="app-add">
  158. <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
  159. <el-row>
  160. <el-col :span="24">
  161. <h3 style="width: 160px;text-align: right;">基础信息</h3>
  162. </el-col>
  163. </el-row>
  164. <el-row>
  165. <el-col :span="6">
  166. <el-form-item label="饲料名称:" prop="fname">
  167. <el-input ref="fname" v-model="create.temp.fname" class="filter-item" placeholder="请输入饲料名称" type="textarea" :autosize="{ minRows:1}" maxlength="32" />
  168. </el-form-item>
  169. </el-col>
  170. <el-col :span="6">
  171. <el-form-item label="饲料类别:" prop="fclassid">
  172. <el-select v-model="create.temp.fclassid" filterable placeholder="饲料类别" class="filter-item" style="width: 100%;" @change="changeFeedList">
  173. <el-option v-for="item in feedTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
  174. </el-select>
  175. </el-form-item></el-col>
  176. <el-col :span="6">
  177. <el-form-item label="唯一编码:" prop="feedcode">
  178. <el-input ref="feedcode" v-model="create.temp.feedcode" class="filter-item" placeholder="请输入唯一编码" type="text" />
  179. </el-form-item>
  180. </el-col>
  181. <el-col :span="6">
  182. <el-form-item label="饲料来源:" prop="source">
  183. <el-input ref="source" v-model="create.temp.source" class="filter-item" disabled placeholder="用户自定义" type="text" />
  184. </el-form-item>
  185. </el-col>
  186. </el-row>
  187. <el-row>
  188. <el-col :span="6">
  189. <el-form-item label="计划类型:" prop="printgroupid">
  190. <el-select v-model="create.temp.printgroupid" filterable placeholder="计划类型" class="filter-item" style="width: 100%;" @change="changePlanList">
  191. <el-option v-for="item in planTypeList" :key="item.value" :label="item.label" :value="item.value" />
  192. </el-select>
  193. </el-form-item>
  194. </el-col>
  195. <el-col :span="6">
  196. <el-form-item label="包装单位重量(kg):" prop="unitweight">
  197. <el-input ref="unitweight" v-model="create.temp.unitweight" class="filter-item" placeholder="正整数" type="number" style="width: 100%;" />
  198. </el-form-item>
  199. </el-col>
  200. <el-col :span="6">
  201. <el-form-item label="单价:" prop="uprice">
  202. <el-input ref="uprice" v-model="create.temp.uprice" v-limit class="filter-item" placeholder="最多俩位小数" type="number" step="0.01" style="width: 100%;" />
  203. </el-form-item>
  204. </el-col>
  205. </el-row>
  206. <el-row>
  207. <el-col :span="24">
  208. <h3 style="width: 160px;text-align: right;">搅拌参数</h3>
  209. </el-col>
  210. </el-row>
  211. <el-row>
  212. <el-col :span="6">
  213. <el-form-item label="允许误差数(kg):" prop="allowratio">
  214. <el-input ref="allowratio" v-model="create.temp.allowratio" class="filter-item" placeholder="正整数" type="text" />
  215. </el-form-item>
  216. </el-col>
  217. <el-col :span="6">
  218. <el-form-item label="跳转重量域(kg):" prop="autozone">
  219. <el-input ref="autozone" v-model="create.temp.autozone" :disabled="create.temp.autosecond=='0'" class="filter-item" placeholder="0-20之间的整数" type="text" />
  220. </el-form-item>
  221. </el-col>
  222. <el-col :span="6">
  223. <el-form-item label="跳转延时:" prop="autosecond">
  224. <el-select v-model="create.temp.autosecond" filterable placeholder="跳转延时" class="filter-item" style="width: 100%;" @change="changeAutosecond">
  225. <el-option v-for="item in jumpDelayList" :key="item.value" :label="item.label" :value="item.value" />
  226. </el-select>
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="6">
  230. <el-form-item label="确认开始:" prop="confirmstart">
  231. <el-select v-model="create.temp.confirmstart" filterabler placeholde="确认开始" class="filter-item" style="width: 100%;" @change="changeConfirmstart">
  232. <el-option v-for="item in confirmStartList" :key="item.id" :label="item.name" :value="item.id" />
  233. </el-select>
  234. </el-form-item>
  235. </el-col>
  236. </el-row>
  237. <el-row>
  238. <el-col :span="6">
  239. <el-form-item label="是否启用:" prop="enable">
  240. <el-select v-model="create.temp.enable" filterable placeholder="是否启用" class="filter-item" style="width: 100%;">
  241. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  242. </el-select>
  243. </el-form-item>
  244. </el-col>
  245. <el-col :span="6">
  246. <el-form-item label="继电器位置:" prop="trgaddress">
  247. <el-input ref="trgaddress" v-model="create.temp.trgaddress" class="filter-item" placeholder="继电器位置" type="number" />
  248. </el-form-item>
  249. </el-col>
  250. </el-row>
  251. <el-row>
  252. <h3 style="width: 160px;text-align: right;">备用字段</h3>
  253. </el-row>
  254. <el-row>
  255. <el-col :span="6">
  256. <el-form-item label="备用字段01:" prop="backup1">
  257. <el-input ref="backup1" v-model="create.temp.backup1" class="filter-item" placeholder="备用字段01" type="text" />
  258. </el-form-item>
  259. </el-col>
  260. <el-col :span="6">
  261. <el-form-item label="备用字段02:" prop="backup2">
  262. <el-input ref="backup2" v-model="create.temp.backup2" class="filter-item" placeholder="备用字段02" type="text" />
  263. </el-form-item>
  264. </el-col>
  265. <el-col :span="6">
  266. <el-form-item label="备用字段03:" prop="backup3">
  267. <el-input ref="backup3" v-model="create.temp.backup3" class="filter-item" placeholder="备用字段03" type="text" />
  268. </el-form-item>
  269. </el-col>
  270. </el-row>
  271. </el-form>
  272. <div slot="footer" class="dialog-footer">
  273. <el-button class="cancelClose" @click="create.dialogFormVisible = false; ">关闭</el-button>
  274. <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="success" :disabled="isokDisable" @click="create.dialogStatus==='create'?createData():updateData()">确认</el-button>
  275. </div>
  276. </div>
  277. </el-dialog>
  278. <!-- 饲料库 -->
  279. <el-dialog :title="textMap[feedBank.dialogStatus]" :visible.sync="feedBank.dialogFormVisible" :close-on-click-modal="false" width="90%">
  280. <div class="app-add">
  281. <div class="search">
  282. <el-input v-model="feedBank.getdataListParm.parammaps.fname" placeholder="饲料名称" style="width: 130px;" class="filter-item" clearable />
  283. <el-select v-model="feedBank.getdataListParm.parammaps.statue" filterabler placeholder="关联状态" class="filter-item" style="width: 120px;" clearable>
  284. <el-option v-for="item in associationStatusList" :key="item.id" :label="item.name" :value="item.id" />
  285. </el-select>
  286. <el-button class="successBorder" @click="handleFeedBankSearch">查询</el-button>
  287. <el-button class="successBorder" @click="handleFeedBankRefresh">重置</el-button>
  288. </div>
  289. <div class="table">
  290. <el-table
  291. :key="feedBank.tableKey"
  292. v-loading="feedBank.listLoading"
  293. element-loading-text="给我一点时间"
  294. :data="feedBank.list"
  295. border
  296. fit
  297. highlight-current-row
  298. style="width: 100%;margin: 0 auto 50px;"
  299. :row-style="rowStyle"
  300. :cell-style="cellStyle"
  301. class="elTable table-fixed"
  302. >
  303. <el-table-column label="序号" align="center" type="index" width="50px" />
  304. <el-table-column label="来源" min-width="90" align="center">
  305. <template slot-scope="scope">
  306. <span>{{ scope.row.sources }}</span>
  307. </template>
  308. </el-table-column>
  309. <el-table-column label="中国饲料号" min-width="100px" align="center">
  310. <template slot-scope="scope">
  311. <span>{{ scope.row.feedcode }}</span>
  312. </template>
  313. </el-table-column>
  314. <el-table-column label="饲料名称" min-width="90px" align="center">
  315. <template slot-scope="scope">
  316. <span>{{ scope.row.fname }}</span>
  317. </template>
  318. </el-table-column>
  319. <el-table-column label="价格" min-width="80px" align="center">
  320. <template slot-scope="scope">
  321. <span>{{ scope.row.price }}</span>
  322. </template>
  323. </el-table-column>
  324. <el-table-column label="样品说明" min-width="90px" align="center">
  325. <template slot-scope="scope">
  326. <span>{{ scope.row.remark }}</span>
  327. </template>
  328. </el-table-column>
  329. <el-table-column label="干物质(DM%)" min-width="70px" align="center">
  330. <template slot-scope="scope">
  331. <span>{{ scope.row.dry }}</span>
  332. </template>
  333. </el-table-column>
  334. <el-table-column label="淀粉(%DM)" min-width="70px" align="center">
  335. <template slot-scope="scope">
  336. <span>{{ scope.row.starch }}</span>
  337. </template>
  338. </el-table-column>
  339. <el-table-column label="粗蛋白(CP%DM)" min-width="75px" align="center">
  340. <template slot-scope="scope">
  341. <span>{{ scope.row.cp }}</span>
  342. </template>
  343. </el-table-column>
  344. <el-table-column label="钙(Ca%DM)" min-width="80px" align="center">
  345. <template slot-scope="scope">
  346. <span>{{ scope.row.ca }}</span>
  347. </template>
  348. </el-table-column>
  349. <el-table-column label="磷(P%DM)" min-width="80px" align="center">
  350. <template slot-scope="scope">
  351. <span>{{ scope.row.p }}</span>
  352. </template>
  353. </el-table-column>
  354. <el-table-column label="产奶净能(%DM)" min-width="80px" align="center">
  355. <template slot-scope="scope">
  356. <span>{{ scope.row.n }}</span>
  357. </template>
  358. </el-table-column>
  359. <el-table-column label="脂肪(%DM)" min-width="70px" align="center">
  360. <template slot-scope="scope">
  361. <span>{{ scope.row.fat }}</span>
  362. </template>
  363. </el-table-column>
  364. <el-table-column label="ADF(%DM)" min-width="80px" align="center">
  365. <template slot-scope="scope">
  366. <span>{{ scope.row.adf }}</span>
  367. </template>
  368. </el-table-column>
  369. <el-table-column label="NDF(%DM)" min-width="80px" align="center">
  370. <template slot-scope="scope">
  371. <span>{{ scope.row.ndf }}</span>
  372. </template>
  373. </el-table-column>
  374. <el-table-column label="NDIP%" min-width="80px" align="center">
  375. <template slot-scope="scope">
  376. <span>{{ scope.row.ndip }}</span>
  377. </template>
  378. </el-table-column>
  379. <el-table-column label="粗灰分(Ash%)" min-width="70px" align="center">
  380. <template slot-scope="scope">
  381. <span>{{ scope.row.ash }}</span>
  382. </template>
  383. </el-table-column>
  384. <el-table-column label="粗料" min-width="70px" align="center">
  385. <template slot-scope="scope">
  386. <span>{{ scope.row.iscu }}</span>
  387. </template>
  388. </el-table-column>
  389. <el-table-column label="关联状态" min-width="70px" align="center">
  390. <template slot-scope="scope">
  391. <span v-if="scope.row.statue==0">否</span>
  392. <span v-if="scope.row.statue==1">是</span>
  393. </template>
  394. </el-table-column>
  395. </el-table>
  396. </div>
  397. <div slot="footer" class="dialog-footer">
  398. <el-button class="cancelClose" @click="feedBank.dialogFormVisible = false; ">关闭</el-button>
  399. </div>
  400. </div>
  401. </el-dialog>
  402. <!-- 关联 -->
  403. <el-dialog :title="textMap[relation.dialogStatus]" :visible.sync="relation.dialogFormVisible" :close-on-click-modal="false" width="90%">
  404. <div class="app-add">
  405. <div class="search">
  406. <el-input v-model="relation.getdataListParm.parammaps.fname" placeholder="饲料名称" style="width: 130px;" class="filter-item" clearable />
  407. <el-button class="successBorder" @click="handleRelationSearch">查询</el-button>
  408. </div>
  409. <div class="table">
  410. <el-table
  411. :key="relation.tableKey"
  412. v-loading="relation.listLoading"
  413. element-loading-text="给我一点时间"
  414. :data="relation.list"
  415. border
  416. fit
  417. highlight-current-row
  418. style="width: 100%;margin: 0 auto 50px;"
  419. :row-style="rowStyle"
  420. :cell-style="cellStyle"
  421. class="elTable table-fixed"
  422. >
  423. <el-table-column label="序号" align="center" type="index" width="50px" />
  424. <el-table-column label="来源" min-width="90" align="center">
  425. <template slot-scope="scope">
  426. <span>{{ scope.row.sources }}</span>
  427. </template>
  428. </el-table-column>
  429. <el-table-column label="中国饲料号" min-width="100px" align="center">
  430. <template slot-scope="scope">
  431. <span>{{ scope.row.feedcode }}</span>
  432. </template>
  433. </el-table-column>
  434. <el-table-column label="饲料名称" min-width="90px" align="center">
  435. <template slot-scope="scope">
  436. <span>{{ scope.row.fname }}</span>
  437. </template>
  438. </el-table-column>
  439. <el-table-column label="价格" min-width="80px" align="center">
  440. <template slot-scope="scope">
  441. <span>{{ scope.row.price }}</span>
  442. </template>
  443. </el-table-column>
  444. <el-table-column label="样品说明" min-width="90px" align="center">
  445. <template slot-scope="scope">
  446. <span>{{ scope.row.remark }}</span>
  447. </template>
  448. </el-table-column>
  449. <el-table-column label="干物质(DM%)" min-width="70px" align="center">
  450. <template slot-scope="scope">
  451. <span>{{ scope.row.dry }}</span>
  452. </template>
  453. </el-table-column>
  454. <el-table-column label="淀粉(%DM)" min-width="70px" align="center">
  455. <template slot-scope="scope">
  456. <span>{{ scope.row.starch }}</span>
  457. </template>
  458. </el-table-column>
  459. <el-table-column label="粗蛋白(CP%DM)" min-width="75px" align="center">
  460. <template slot-scope="scope">
  461. <span>{{ scope.row.cp }}</span>
  462. </template>
  463. </el-table-column>
  464. <el-table-column label="钙(Ca%DM)" min-width="80px" align="center">
  465. <template slot-scope="scope">
  466. <span>{{ scope.row.ca }}</span>
  467. </template>
  468. </el-table-column>
  469. <el-table-column label="磷(P%DM)" min-width="80px" align="center">
  470. <template slot-scope="scope">
  471. <span>{{ scope.row.p }}</span>
  472. </template>
  473. </el-table-column>
  474. <el-table-column label="产奶净能(%DM)" min-width="80px" align="center">
  475. <template slot-scope="scope">
  476. <span>{{ scope.row.n }}</span>
  477. </template>
  478. </el-table-column>
  479. <el-table-column label="脂肪(%DM)" min-width="70px" align="center">
  480. <template slot-scope="scope">
  481. <span>{{ scope.row.fat }}</span>
  482. </template>
  483. </el-table-column>
  484. <el-table-column label="ADF(%DM)" min-width="80px" align="center">
  485. <template slot-scope="scope">
  486. <span>{{ scope.row.adf }}</span>
  487. </template>
  488. </el-table-column>
  489. <el-table-column label="NDF(%DM)" min-width="80px" align="center">
  490. <template slot-scope="scope">
  491. <span>{{ scope.row.ndf }}</span>
  492. </template>
  493. </el-table-column>
  494. <el-table-column label="NDIP%" min-width="80px" align="center">
  495. <template slot-scope="scope">
  496. <span>{{ scope.row.ndip }}</span>
  497. </template>
  498. </el-table-column>
  499. <el-table-column label="粗灰分(Ash%)" min-width="70px" align="center">
  500. <template slot-scope="scope">
  501. <span>{{ scope.row.ash }}</span>
  502. </template>
  503. </el-table-column>
  504. <el-table-column label="粗料" min-width="70px" align="center">
  505. <template slot-scope="scope">
  506. <span>{{ scope.row.iscu }}</span>
  507. </template>
  508. </el-table-column>
  509. <el-table-column label="操作" min-width="150px" align="center" class-name="small-padding fixed-width" fixed="right">
  510. <template slot-scope="{row}">
  511. <el-button v-if="row.statueRelation == '1'" class="miniSuccess" :disabled="isokDisable" @click="disassociateData(row)">取消关联</el-button>
  512. <el-button v-if="row.statueRelation == '0'" class="miniSuccess" :disabled="isokDisable" @click="relationData(row)">关联</el-button>
  513. </template>
  514. </el-table-column>
  515. </el-table>
  516. </div>
  517. <div slot="footer" class="dialog-footer">
  518. <el-button class="cancelClose" @click="relation.dialogFormVisible = false;getList() ">关闭</el-button>
  519. </div>
  520. </div>
  521. </el-dialog>
  522. <!-- 营养价值 -->
  523. <el-dialog :title="textMap[nutritive.dialogStatus]" :visible.sync="nutritive.dialogFormVisible" :close-on-click-modal="false" width="90%">
  524. <div class="app-add">
  525. <el-form ref="temp" :rules="nutritive.rules" :model="nutritive.temp" label-position="right" label-width="160px" style="width: 100%;margin:0 auto 50px">
  526. <el-row>
  527. <el-col :span="6">
  528. <el-form-item label="干物质(DM%):" prop="dry">
  529. <el-input ref="dry" v-model="nutritive.temp.dry" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入干物质" type="number" step="0.01" />
  530. </el-form-item>
  531. </el-col>
  532. <el-col :span="6">
  533. <el-form-item label="淀粉(%DM):" prop="starch">
  534. <el-input ref="starch" v-model="nutritive.temp.starch" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入淀粉" type="number" step="0.01" />
  535. </el-form-item>
  536. </el-col>
  537. <el-col :span="6">
  538. <el-form-item label="粗蛋白(CP%DM):" prop="cp">
  539. <el-input ref="cp" v-model="nutritive.temp.cp" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入粗蛋白" type="number" step="0.01" />
  540. </el-form-item>
  541. </el-col>
  542. <el-col :span="6">
  543. <el-form-item label="钙(Ca%DM):" prop="ca">
  544. <el-input ref="ca" v-model="nutritive.temp.ca" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入钙" type="number" step="0.01" />
  545. </el-form-item>
  546. </el-col>
  547. </el-row>
  548. <el-row>
  549. <el-col :span="6">
  550. <el-form-item label="磷(P%DM):" prop="p">
  551. <el-input ref="p" v-model="nutritive.temp.p" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入磷" type="number" step="0.01" />
  552. </el-form-item>
  553. </el-col>
  554. <el-col :span="6">
  555. <el-form-item label="产奶净能(%DM):" prop="n">
  556. <el-input ref="n" v-model="nutritive.temp.n" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入产奶净能" type="number" step="0.01" />
  557. </el-form-item>
  558. </el-col>
  559. <el-col :span="6">
  560. <el-form-item label="脂肪(%DM):" prop="fat">
  561. <el-input ref="fat" v-model="nutritive.temp.fat" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入脂肪" type="number" step="0.01" />
  562. </el-form-item>
  563. </el-col>
  564. <el-col :span="6">
  565. <el-form-item label="ADF(%DM):" prop="adf">
  566. <el-input ref="adf" v-model="nutritive.temp.adf" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入ADF" type="number" step="0.01" />
  567. </el-form-item>
  568. </el-col>
  569. </el-row>
  570. <el-row>
  571. <el-col :span="6">
  572. <el-form-item label="NDF(%DM):" prop="ndf">
  573. <el-input ref="ndf" v-model="nutritive.temp.ndf" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入NDF" type="number" step="0.01" />
  574. </el-form-item>
  575. </el-col>
  576. <el-col :span="6">
  577. <el-form-item label="NDIP(%):" prop="ndip">
  578. <el-input ref="ndip" v-model="nutritive.temp.ndip" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入NDIP" type="number" step="0.01" />
  579. </el-form-item>
  580. </el-col>
  581. <el-col :span="6">
  582. <el-form-item label="粗灰分(Ash%):" prop="ash">
  583. <el-input ref="ash" v-model="nutritive.temp.ash" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入粗灰分" type="number" min="0.00" step="0.01" />
  584. </el-form-item>
  585. </el-col>
  586. </el-row>
  587. </el-form>
  588. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
  589. <el-button @click="nutritive.dialogFormVisible = false;getList()">关闭</el-button>
  590. <el-button v-if="nutritive.dialogStatus==='nutritive' && isRoleEdit" type="success" :disabled="isokDisable" @click="nutritiveData()">确认</el-button>
  591. </div>
  592. </div>
  593. </el-dialog>
  594. </div>
  595. </template>
  596. <script>
  597. import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames, checkButtons } from '@/api/common'
  598. import Cookies from 'js-cookie'
  599. import Pagination from '@/components/Pagination'
  600. import { MessageBox } from 'element-ui'
  601. export default {
  602. name: 'FeedTable',
  603. components: { Pagination },
  604. directives: {
  605. limit: {
  606. // 指令的定义
  607. update: function(el) {
  608. el.onkeypress = function(e) {
  609. var code = e.charCode
  610. if (code != 0) {
  611. if (!String.fromCharCode(code).match(/[0-9\.]/)) {
  612. return false
  613. }
  614. }
  615. }
  616. el.addEventListener('textInput', function(e) {
  617. e.target.value = e.target.value.replace(/[^0-9\.]/g, '')
  618. })
  619. el.onkeyup = function(e) {
  620. e.target.value = e.target.value.replace(/[^0-9\.]/g, '')
  621. }
  622. }
  623. }
  624. },
  625. data() {
  626. return {
  627. isRoleEdit: [],
  628. requestParams: [
  629. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['跳转延时'] },
  630. { name: 'getFeedclassByBig', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  631. { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['计划类型'] }
  632. ],
  633. enableList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用
  634. feedSourcesList: [{ id: '0', name: '系统内置' }, { id: '1', name: '用户自定义' }], // 饲料来源
  635. confirmStartList: [{ id: '0', name: '禁用' }, { id: '1', name: '启用' }], // 确认开始
  636. associationStatusList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 关联状态
  637. jumpDelayList: [], // 跳转延时
  638. feedTypeList: [], // 饲料分类
  639. planTypeList: [], // 计划类型
  640. table: {
  641. tableKey: 0,
  642. list: [],
  643. total: 0,
  644. listLoading: true,
  645. getdataListParm: {
  646. name: 'getFeedList',
  647. page: 1,
  648. offset: 1,
  649. pagecount: 10,
  650. returntype: 'Map',
  651. parammaps: {
  652. pastureid: Cookies.get('pastureid'),
  653. fname: '',
  654. fclassid: '',
  655. source: '',
  656. autozone: '',
  657. autosecond: '',
  658. allowratio: '',
  659. printgroup: '',
  660. enable: ''
  661. }
  662. }
  663. },
  664. // 多项搜索显示隐藏
  665. arrowDown: true,
  666. arrowUp: false,
  667. // 新增/编辑
  668. create: {
  669. dialogFormVisible: false,
  670. dialogStatus: '',
  671. temp: { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '' },
  672. rules: {
  673. fname: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  674. fclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  675. feedcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  676. }
  677. },
  678. // 饲料库
  679. feedBank: {
  680. dialogFormVisible: false,
  681. dialogStatus: '',
  682. temp: {},
  683. rules: {},
  684. tableKey: 0,
  685. list: [],
  686. total: 0,
  687. listLoading: true,
  688. getdataListParm: {
  689. name: 'getFeednurList',
  690. page: 1,
  691. offset: 1,
  692. returntype: 'Map',
  693. parammaps: {
  694. pastureid: Cookies.get('pastureid'),
  695. fname: '',
  696. statue: ''
  697. }
  698. }
  699. },
  700. // 关联
  701. relation: {
  702. dialogFormVisible: false,
  703. dialogStatus: '',
  704. temp: {},
  705. rules: {},
  706. tableKey: 0,
  707. list: [],
  708. total: 0,
  709. listLoading: true,
  710. getdataListParm: {
  711. name: 'getFeednurRelation',
  712. page: 1,
  713. offset: 1,
  714. returntype: 'Map',
  715. parammaps: {
  716. pastureid: Cookies.get('pastureid'),
  717. fname: ''
  718. }
  719. }
  720. },
  721. // 营养价值
  722. nutritive: {
  723. dialogFormVisible: false,
  724. dialogStatus: '',
  725. temp: {},
  726. rules: {}
  727. },
  728. textMap: {
  729. create: '新增',
  730. update: '编辑',
  731. feedBank: '饲料库',
  732. relation: '关联',
  733. nutritive: '营养价值'
  734. },
  735. isokDisable: false,
  736. selectList: [],
  737. requestParam: {},
  738. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  739. cellStyle: { padding: 0 + 'px' }
  740. }
  741. },
  742. mounted() {
  743. document.addEventListener('click', (e) => {
  744. if (this.$refs.selectInput !== undefined) {
  745. if (!this.$refs.selectInput.contains(e.target)) {
  746. this.arrowDown = true
  747. this.arrowUp = false
  748. } else {
  749. this.arrowDown = false
  750. this.arrowUp = true
  751. }
  752. }
  753. })
  754. },
  755. created() {
  756. this.getList()
  757. this.getDownList()
  758. this.getButtons()
  759. },
  760. methods: {
  761. getButtons() {
  762. const Edit = 'FeedTable'
  763. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  764. this.isRoleEdit = isRoleEdit
  765. },
  766. getDownList() {
  767. GetDataByNames(this.requestParams).then(response => {
  768. this.jumpDelayList = response.data.getDictByName.list
  769. this.feedTypeList = response.data.getFeedclassByBig.list
  770. this.planTypeList = response.data.getDictByName2.list
  771. })
  772. },
  773. getList() {
  774. this.table.listLoading = true
  775. GetDataByName(this.table.getdataListParm).then(response => {
  776. console.log('table数据', response.data.list)
  777. if (response.data.list !== null) {
  778. this.table.list = response.data.list
  779. this.table.pageNum = response.data.pageNum
  780. this.table.pageSize = response.data.pageSize
  781. this.table.total = response.data.total
  782. } else {
  783. this.table.list = []
  784. }
  785. setTimeout(() => {
  786. this.table.listLoading = false
  787. }, 100)
  788. })
  789. },
  790. handleSearch() {
  791. console.log('点击了查询')
  792. this.table.getdataListParm.offset = 1
  793. this.getList()
  794. this.arrowDown = true
  795. this.arrowUp = false
  796. },
  797. handleRefresh() {
  798. console.log('点击了重置')
  799. this.table.getdataListParm.parammaps.fname = ''
  800. this.table.getdataListParm.parammaps.fclassid = ''
  801. this.table.getdataListParm.parammaps.source = ''
  802. this.table.getdataListParm.parammaps.autozone = ''
  803. this.table.getdataListParm.parammaps.autosecond = ''
  804. this.table.getdataListParm.parammaps.allowratio = ''
  805. this.table.getdataListParm.parammaps.printgroup = ''
  806. this.table.getdataListParm.parammaps.enable = ''
  807. this.table.getdataListParm.offset = 1
  808. this.getList()
  809. },
  810. resetTemp() {
  811. this.create.temp = { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '' }
  812. },
  813. // 计划类型
  814. changePlanList(item) {
  815. this.create.temp.printgroup = this.planTypeList.find(obj => obj.value === item).label
  816. },
  817. // 饲料类型
  818. changeFeedList(item) {
  819. this.create.temp.fclass = this.feedTypeList.find(obj => obj.id === item).mixname
  820. },
  821. // 跳转延时
  822. changeAutosecond(item) {
  823. this.create.temp.autosecondname = this.jumpDelayList.find(obj => obj.value === item).label
  824. },
  825. // 确认开始
  826. changeConfirmstart(item) {
  827. this.create.temp.confirmstartname = this.confirmStartList.find(obj => obj.id === item).name
  828. },
  829. // 新增
  830. handleCreate() {
  831. console.log('点击了新增')
  832. this.resetTemp()
  833. this.create.dialogStatus = 'create'
  834. this.create.dialogFormVisible = true
  835. },
  836. createData() {
  837. console.log('点击了新增保存')
  838. this.isokDisable = true
  839. setTimeout(() => {
  840. this.isokDisable = false
  841. }, 1000)
  842. this.$refs['temp'].validate(valid => {
  843. if (valid) {
  844. const unitweight = /^[1-9]\d*$/
  845. if (this.create.temp.unitweight !== '') {
  846. if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
  847. this.$message({ type: 'error', message: '包装单位重量请输入正整数', duration: 2000 })
  848. return false
  849. }
  850. }
  851. const uprice = /^\d+(\.\d{1,2})?$/
  852. if (this.create.temp.uprice !== '') {
  853. if (!uprice.test(parseFloat(this.create.temp.uprice))) {
  854. this.$message({ type: 'error', message: '单价请保留两位小数', duration: 2000 })
  855. return false
  856. }
  857. }
  858. if (this.create.temp.autozone !== '') {
  859. const autozone = /^([0-9]|(1[0-9]|(20)))$/
  860. if (!autozone.test(parseFloat(this.create.temp.autozone))) {
  861. this.$message({ type: 'error', message: '跳转重量域请输入大于等于0小于等于20的整数', duration: 2000 })
  862. return false
  863. }
  864. } else {
  865. this.create.temp.autozone = '0'
  866. }
  867. if (this.create.temp.trgaddress.length > 8) {
  868. this.$message({ type: 'error', message: '继电器位置请输入1-8位数字', duration: 2000 })
  869. return false
  870. }
  871. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  872. if (pattern.test(this.create.temp.fname)) {
  873. this.$message({ type: 'error', message: '饲料名称不可输入特殊字符', duration: 2000 })
  874. return false
  875. }
  876. const allowratio = /^[0-9]\d*$/
  877. if (this.create.temp.allowratio !== '') {
  878. if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
  879. this.$message({ type: 'error', message: '允许误差数请输入大于等于0的整数', duration: 2000 })
  880. return false
  881. }
  882. }
  883. this.isokDisable = true
  884. setTimeout(() => {
  885. this.isokDisable = false
  886. }, 1000)
  887. this.requestParam.name = 'insertFeed'
  888. this.requestParam.parammaps = this.create.temp
  889. if (this.create.temp.allowratio == '') { this.create.temp.allowratio = '0' }
  890. if (this.create.temp.uprice == '') { this.create.temp.uprice = '0' }
  891. if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
  892. if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
  893. if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
  894. PostDataByName(this.requestParam).then(response => {
  895. console.log('新增保存发送参数', this.requestParam)
  896. if (response.msg !== 'fail') {
  897. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  898. this.create.dialogFormVisible = false
  899. this.getList()
  900. } else {
  901. failproccess(response, this.$notify)
  902. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  903. if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
  904. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  905. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  906. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  907. }
  908. })
  909. }
  910. })
  911. },
  912. // 编辑
  913. handleUpdate(row) {
  914. console.log('点击了编辑')
  915. this.create.dialogStatus = 'update'
  916. this.create.dialogFormVisible = true
  917. row.fclassid = String(row.fclassid)
  918. row.printgroupid = String(row.printgroupid)
  919. row.autosecond = String(row.autosecond)
  920. row.confirmstart = String(row.confirmstart)
  921. row.enable = String(row.enable)
  922. this.create.temp = Object.assign({}, row)
  923. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  924. if (this.create.temp.uprice == '0.00') { this.create.temp.uprice = '' }
  925. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  926. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  927. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  928. },
  929. updateData() {
  930. console.log('点击了编辑保存')
  931. this.isokDisable = true
  932. setTimeout(() => {
  933. this.isokDisable = false
  934. }, 1000)
  935. this.$refs['temp'].validate(valid => {
  936. if (valid) {
  937. const unitweight = /^[1-9]\d*$/
  938. if (this.create.temp.unitweight !== '') {
  939. if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
  940. this.$message({ type: 'error', message: '包装单位重量请输入正整数', duration: 2000 })
  941. return false
  942. }
  943. }
  944. const uprice = /^\d+(\.\d{1,2})?$/
  945. if (this.create.temp.uprice !== '') {
  946. if (!uprice.test(parseFloat(this.create.temp.uprice))) {
  947. this.$message({ type: 'error', message: '单价请保留两位小数', duration: 2000 })
  948. return false
  949. }
  950. }
  951. if (this.create.temp.autozone !== '') {
  952. const autozone = /^([0-9]|(1[0-9]|(20)))$/
  953. if (!autozone.test(parseFloat(this.create.temp.autozone))) {
  954. this.$message({ type: 'error', message: '跳转重量域请输入大于等于0小于等于20的整数', duration: 2000 })
  955. return false
  956. }
  957. } else {
  958. this.create.temp.autozone = '0'
  959. }
  960. if (this.create.temp.trgaddress.length > 8) {
  961. this.$message({ type: 'error', message: '继电器位置请输入1-8位数字', duration: 2000 })
  962. return false
  963. }
  964. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  965. if (pattern.test(this.create.temp.fname)) {
  966. this.$message({ type: 'error', message: '饲料名称不可输入特殊字符', duration: 2000 })
  967. return false
  968. }
  969. const allowratio = /^[0-9]\d*$/
  970. if (this.create.temp.allowratio !== '') {
  971. if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
  972. this.$message({ type: 'error', message: '允许误差数请输入大于等于0的整数', duration: 2000 })
  973. return false
  974. }
  975. }
  976. this.isokDisable = true
  977. setTimeout(() => {
  978. this.isokDisable = false
  979. }, 1000)
  980. this.requestParam.name = 'updateFeed'
  981. this.requestParam.parammaps = this.create.temp
  982. if (this.create.temp.allowratio == '') { this.create.temp.allowratio = '0' }
  983. if (this.create.temp.uprice == '') { this.create.temp.uprice = '0' }
  984. if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
  985. if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
  986. if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
  987. PostDataByName(this.requestParam).then(response => {
  988. console.log('新增保存发送参数', this.requestParam)
  989. if (response.msg !== 'fail') {
  990. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  991. this.create.dialogFormVisible = false
  992. this.getList()
  993. } else {
  994. failproccess(response, this.$notify)
  995. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  996. if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
  997. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  998. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  999. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  1000. }
  1001. })
  1002. }
  1003. })
  1004. },
  1005. // 饲料库
  1006. handleFeedBank() {
  1007. console.log('点击了饲料库')
  1008. this.feedBank.dialogStatus = 'feedBank'
  1009. this.feedBank.dialogFormVisible = true
  1010. this.getFeedBankList()
  1011. },
  1012. getFeedBankList() {
  1013. this.feedBank.listLoading = true
  1014. GetDataByName(this.feedBank.getdataListParm).then(response => {
  1015. console.log('table数据', response.data.list)
  1016. if (response.data.list !== null) {
  1017. this.feedBank.list = response.data.list
  1018. this.feedBank.pageNum = response.data.pageNum
  1019. this.feedBank.pageSize = response.data.pageSize
  1020. this.feedBank.total = response.data.total
  1021. } else {
  1022. this.feedBank.list = []
  1023. }
  1024. setTimeout(() => {
  1025. this.feedBank.listLoading = false
  1026. }, 100)
  1027. })
  1028. },
  1029. handleFeedBankSearch() {
  1030. console.log('点击了饲料库搜索')
  1031. this.getFeedBankList()
  1032. this.feedBank.getdataListParm.offset = 1
  1033. },
  1034. handleFeedBankRefresh() {
  1035. console.log('点击了饲料库重置')
  1036. this.feedBank.getdataListParm.parammaps.fname = ''
  1037. this.feedBank.getdataListParm.parammaps.statue = ''
  1038. this.getFeedBankList()
  1039. },
  1040. // 关联
  1041. handleRelation(row) {
  1042. console.log('点击了关联')
  1043. this.relation.dialogStatus = 'relation'
  1044. this.relation.dialogFormVisible = true
  1045. this.relation.temp = Object.assign({}, row)
  1046. this.relation.getdataListParm.parammaps.fid = this.relation.temp.id
  1047. this.getRelationList()
  1048. },
  1049. getRelationList() {
  1050. this.relation.listLoading = true
  1051. GetDataByName(this.relation.getdataListParm).then(response => {
  1052. console.log('table数据', response.data.list)
  1053. if (response.data.list !== null) {
  1054. this.relation.list = response.data.list
  1055. this.relation.pageNum = response.data.pageNum
  1056. this.relation.pageSize = response.data.pageSize
  1057. this.relation.total = response.data.total
  1058. } else {
  1059. this.relation.list = []
  1060. }
  1061. setTimeout(() => {
  1062. this.relation.listLoading = false
  1063. }, 100)
  1064. })
  1065. },
  1066. handleRelationSearch() {
  1067. console.log('点击了关联搜索')
  1068. this.relation.getdataListParm.offset = 1
  1069. this.getRelationList()
  1070. },
  1071. disassociateData(row) {
  1072. console.log('点击了取消关联')
  1073. MessageBox.confirm('是否确认取消关联?', {
  1074. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1075. }).then(() => {
  1076. this.isokDisable = true
  1077. setTimeout(() => {
  1078. this.isokDisable = false
  1079. }, 1000)
  1080. this.requestParam.name = 'updateFeedrelation'
  1081. this.requestParam.parammaps = {}
  1082. this.requestParam.parammaps.pastureid = this.relation.temp.pastureid
  1083. this.requestParam.parammaps.fid = this.relation.temp.id
  1084. this.requestParam.parammaps.id = row.id
  1085. PostDataByName(this.requestParam).then(response => {
  1086. console.log('取消关联保存发送参数', this.requestParam)
  1087. if (response.msg !== 'fail') {
  1088. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1089. this.getRelationList()
  1090. this.getList()
  1091. } else {
  1092. failproccess(response, this.$notify)
  1093. }
  1094. })
  1095. }).catch(() => {
  1096. this.$message({ type: 'info', message: '已取消' })
  1097. })
  1098. },
  1099. relationData(row) {
  1100. console.log('点击了关联保存')
  1101. MessageBox.confirm('是否确认关联?', {
  1102. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1103. }).then(() => {
  1104. this.isokDisable = true
  1105. setTimeout(() => {
  1106. this.isokDisable = false
  1107. }, 1000)
  1108. this.requestParam.name = 'insertFeednur'
  1109. this.requestParam.parammaps = {}
  1110. this.requestParam.parammaps.pastureid = this.relation.temp.pastureid
  1111. this.requestParam.parammaps.fid = this.relation.temp.id
  1112. this.requestParam.parammaps.fname = this.relation.temp.fname
  1113. this.requestParam.parammaps.feedcode = this.relation.temp.feedcode
  1114. this.requestParam.parammaps.price = row.price
  1115. this.requestParam.parammaps.remark = row.remark
  1116. this.requestParam.parammaps.dry = row.dry
  1117. this.requestParam.parammaps.starch = row.starch
  1118. this.requestParam.parammaps.cp = row.cp
  1119. this.requestParam.parammaps.ca = row.ca
  1120. this.requestParam.parammaps.p = row.p
  1121. this.requestParam.parammaps.n = row.n
  1122. this.requestParam.parammaps.fat = row.fat
  1123. this.requestParam.parammaps.adf = row.adf
  1124. this.requestParam.parammaps.ndf = row.ndf
  1125. this.requestParam.parammaps.ndip = row.ndip
  1126. this.requestParam.parammaps.ash = row.ash
  1127. this.requestParam.parammaps.fpercent = row.fpercent
  1128. this.requestParam.parammaps.iscu = row.iscu
  1129. this.requestParam.parammaps.feednurid = row.id
  1130. PostDataByName(this.requestParam).then(response => {
  1131. console.log('关联保存发送参数', this.requestParam)
  1132. if (response.msg !== 'fail') {
  1133. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1134. this.getRelationList()
  1135. this.getList()
  1136. } else {
  1137. failproccess(response, this.$notify)
  1138. }
  1139. })
  1140. }).catch(() => {
  1141. this.$message({ type: 'info', message: '已取消' })
  1142. })
  1143. },
  1144. // 营养价值
  1145. handleNutritive(row) {
  1146. console.log('点击了营养价值', row)
  1147. this.nutritive.dialogStatus = 'nutritive'
  1148. this.nutritive.dialogFormVisible = true
  1149. this.nutritive.temp = Object.assign({}, row)
  1150. },
  1151. nutritiveData() {
  1152. console.log('点击了营养价值保存')
  1153. this.isokDisable = true
  1154. setTimeout(() => {
  1155. this.isokDisable = false
  1156. }, 1000)
  1157. if (this.nutritive.temp.dry == undefined) { this.$set(this.nutritive.temp, 'dry', '') }
  1158. if (this.nutritive.temp.starch == undefined) { this.$set(this.nutritive.temp, 'starch', '') }
  1159. if (this.nutritive.temp.cp == undefined) { this.$set(this.nutritive.temp, 'cp', '') }
  1160. if (this.nutritive.temp.ca == undefined) { this.$set(this.nutritive.temp, 'ca', '') }
  1161. if (this.nutritive.temp.p == undefined) { this.$set(this.nutritive.temp, 'p', '') }
  1162. if (this.nutritive.temp.n == undefined) { this.$set(this.nutritive.temp, 'n', '') }
  1163. if (this.nutritive.temp.fat == undefined) { this.$set(this.nutritive.temp, 'fat', '') }
  1164. if (this.nutritive.temp.adf == undefined) { this.$set(this.nutritive.temp, 'adf', '') }
  1165. if (this.nutritive.temp.ndf == undefined) { this.$set(this.nutritive.temp, 'ndf', '') }
  1166. if (this.nutritive.temp.ndip == undefined) { this.$set(this.nutritive.temp, 'ndip', '') }
  1167. if (this.nutritive.temp.ash == undefined) { this.$set(this.nutritive.temp, 'ash', '') }
  1168. var positiveNumber = /^\d+(\.\d{1,2})?$/
  1169. if (this.nutritive.temp.dry !== '') {
  1170. if (!positiveNumber.test(parseFloat(this.nutritive.temp.dry))) {
  1171. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1172. return false
  1173. }
  1174. }
  1175. console.log(this.nutritive.temp.starch)
  1176. if (this.nutritive.temp.starch !== '') {
  1177. if (!positiveNumber.test(parseFloat(this.nutritive.temp.starch))) {
  1178. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1179. return false
  1180. }
  1181. }
  1182. if (this.nutritive.temp.cp !== '') {
  1183. if (!positiveNumber.test(parseFloat(this.nutritive.temp.cp))) {
  1184. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1185. return false
  1186. }
  1187. }
  1188. if (this.nutritive.temp.ca !== '') {
  1189. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ca))) {
  1190. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1191. return false
  1192. }
  1193. }
  1194. if (this.nutritive.temp.p !== '') {
  1195. if (!positiveNumber.test(parseFloat(this.nutritive.temp.p))) {
  1196. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1197. return false
  1198. }
  1199. }
  1200. if (this.nutritive.temp.n !== '') {
  1201. if (!positiveNumber.test(parseFloat(this.nutritive.temp.n))) {
  1202. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1203. return false
  1204. }
  1205. }
  1206. if (this.nutritive.temp.fat !== '') {
  1207. if (!positiveNumber.test(parseFloat(this.nutritive.temp.fat))) {
  1208. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1209. return false
  1210. }
  1211. }
  1212. if (this.nutritive.temp.adf !== '') {
  1213. if (!positiveNumber.test(parseFloat(this.nutritive.temp.adf))) {
  1214. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1215. return false
  1216. }
  1217. }
  1218. if (this.nutritive.temp.ndf !== '') {
  1219. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ndf))) {
  1220. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1221. return false
  1222. }
  1223. }
  1224. if (this.nutritive.temp.ndip !== '') {
  1225. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ndip))) {
  1226. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1227. return false
  1228. }
  1229. }
  1230. if (this.nutritive.temp.ash !== '') {
  1231. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ash))) {
  1232. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1233. return false
  1234. }
  1235. }
  1236. this.requestParam.name = 'insertFeednur'
  1237. this.requestParam.parammaps = {}
  1238. this.requestParam.parammaps.pastureid = this.nutritive.temp.pastureid
  1239. this.requestParam.parammaps.fid = this.nutritive.temp.id
  1240. this.requestParam.parammaps.fname = this.nutritive.temp.fname
  1241. this.requestParam.parammaps.feedcode = this.nutritive.temp.feedcode
  1242. this.requestParam.parammaps.price = this.nutritive.temp.uprice
  1243. this.requestParam.parammaps.remark = this.nutritive.temp.remark
  1244. this.requestParam.parammaps.dry = this.nutritive.temp.dry
  1245. this.requestParam.parammaps.starch = this.nutritive.temp.starch
  1246. this.requestParam.parammaps.cp = this.nutritive.temp.cp
  1247. this.requestParam.parammaps.ca = this.nutritive.temp.ca
  1248. this.requestParam.parammaps.p = this.nutritive.temp.p
  1249. this.requestParam.parammaps.n = this.nutritive.temp.n
  1250. this.requestParam.parammaps.fat = this.nutritive.temp.fat
  1251. this.requestParam.parammaps.adf = this.nutritive.temp.adf
  1252. this.requestParam.parammaps.ndf = this.nutritive.temp.ndf
  1253. this.requestParam.parammaps.ndip = this.nutritive.temp.ndip
  1254. this.requestParam.parammaps.ash = this.nutritive.temp.ash
  1255. this.requestParam.parammaps.fpercent = this.nutritive.temp.fpercent
  1256. this.requestParam.parammaps.iscu = this.nutritive.temp.iscu
  1257. this.requestParam.parammaps.feednurid = '-1'
  1258. PostDataByName(this.requestParam).then(response => {
  1259. console.log('关联保存发送参数', this.requestParam)
  1260. if (response.msg !== 'fail') {
  1261. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1262. this.getList()
  1263. this.nutritive.dialogFormVisible = false
  1264. } else {
  1265. failproccess(response, this.$notify)
  1266. }
  1267. })
  1268. },
  1269. // 行内删除
  1270. handleRowDelete(row) {
  1271. console.log('点击了行内删除')
  1272. MessageBox.confirm('是否确认删除此信息?', {
  1273. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1274. }).then(() => {
  1275. this.selectList = []
  1276. this.requestParam.name = 'deleteFeed'
  1277. this.requestParam.parammaps = {}
  1278. this.requestParam.parammaps.pastureid = row.pastureid
  1279. this.requestParam.parammaps.id = row.id
  1280. PostDataByName(this.requestParam).then(() => {
  1281. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1282. this.getList()
  1283. })
  1284. }).catch(() => {
  1285. this.$message({ type: 'info', message: '已取消删除' })
  1286. })
  1287. },
  1288. handleSelectionChange(val) {
  1289. console.log('勾选数据', val)
  1290. this.selectList = val
  1291. },
  1292. // 多项删除
  1293. handleDelete() {
  1294. console.log('点击了删除')
  1295. if (this.selectList.length == 0) {
  1296. this.$message({ type: 'error', message: '请选择饲料表信息', duration: 2000 })
  1297. } else {
  1298. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  1299. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1300. }).then(() => {
  1301. console.log(this.selectList)
  1302. this.requestParam.common = { 'returnmap': '0' }
  1303. this.requestParam.data = []
  1304. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1305. this.requestParam.data[0].children = []
  1306. this.requestParam.data[0].children[0] = { 'name': 'deleteFeed', 'type': 'e', 'parammaps': {
  1307. id: '@insertSpotList.id',
  1308. pastureid: '@insertSpotList.pastureid'
  1309. }}
  1310. ExecDataByConfig(this.requestParam).then(response => {
  1311. console.log('删除保存发送参数', this.requestParam)
  1312. if (response.msg === 'fail') {
  1313. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1314. } else {
  1315. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1316. this.getList()
  1317. }
  1318. })
  1319. })
  1320. }
  1321. }
  1322. }
  1323. }
  1324. </script>
  1325. <style lang="scss" scoped>
  1326. .search{margin-top:10px;}
  1327. .table{margin-top:10px;}
  1328. $width:350px;
  1329. $left:325px;
  1330. .selectInput{
  1331. position: relative;
  1332. display: inline-block;
  1333. .Input{width: $width;position: relative;}
  1334. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  1335. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  1336. .selectUl{
  1337. z-index: 111;width: $width;background: #fff;border: 1px solid #E4E7ED;box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);margin: -1px 0 0 0;padding: 6px 0; margin: 0;box-sizing: border-box;position: absolute;
  1338. li{
  1339. list-style: none;font-size: 14px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #606266; height: 50px; line-height: 50px; box-sizing: border-box; cursor: pointer;
  1340. a{float:left;width: 80px;}
  1341. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  1342. }
  1343. }
  1344. }
  1345. </style>