fd0d8a2472d4d8dc3322211ee614256926100b2e.svn-base 66 KB

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