bdcaf41950d31e14c70f73f95d001f08f340ae89.svn-base 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button class="success" @click="handleCreate">新增</el-button>
  5. <el-button 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 class="miniSuccess" @click="handleRelation(row)">关联</el-button>
  148. <el-button class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  149. <el-button 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" 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="text" 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" class="filter-item" placeholder="最多俩位小数" type="text" 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" class="filter-item" placeholder="最多俩位小数" 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="textarea" :autosize="{ minRows:1}" maxlength="8" />
  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="cancel" @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. <template slot-scope="scope">
  305. <span>{{ scope.$index + (feedBank.pageNum-1) * feedBank.pageSize + 1 }}</span>
  306. </template>
  307. </el-table-column>
  308. <el-table-column label="来源" min-width="90" align="center">
  309. <template slot-scope="scope">
  310. <span>{{ scope.row.sources }}</span>
  311. </template>
  312. </el-table-column>
  313. <el-table-column label="中国饲料号" min-width="100px" align="center">
  314. <template slot-scope="scope">
  315. <span>{{ scope.row.feedcode }}</span>
  316. </template>
  317. </el-table-column>
  318. <el-table-column label="饲料名称" min-width="90px" align="center">
  319. <template slot-scope="scope">
  320. <span>{{ scope.row.fname }}</span>
  321. </template>
  322. </el-table-column>
  323. <el-table-column label="价格" min-width="80px" align="center">
  324. <template slot-scope="scope">
  325. <span>{{ scope.row.price }}</span>
  326. </template>
  327. </el-table-column>
  328. <el-table-column label="样品说明" min-width="90px" align="center">
  329. <template slot-scope="scope">
  330. <span>{{ scope.row.remark }}</span>
  331. </template>
  332. </el-table-column>
  333. <el-table-column label="干物质(DM%)" min-width="70px" align="center">
  334. <template slot-scope="scope">
  335. <span>{{ scope.row.dry }}</span>
  336. </template>
  337. </el-table-column>
  338. <el-table-column label="淀粉(%DM)" min-width="70px" align="center">
  339. <template slot-scope="scope">
  340. <span>{{ scope.row.starch }}</span>
  341. </template>
  342. </el-table-column>
  343. <el-table-column label="粗蛋白(CP%DM)" min-width="75px" align="center">
  344. <template slot-scope="scope">
  345. <span>{{ scope.row.cp }}</span>
  346. </template>
  347. </el-table-column>
  348. <el-table-column label="钙(Ca%DM)" min-width="80px" align="center">
  349. <template slot-scope="scope">
  350. <span>{{ scope.row.ca }}</span>
  351. </template>
  352. </el-table-column>
  353. <el-table-column label="磷(P%DM)" min-width="80px" align="center">
  354. <template slot-scope="scope">
  355. <span>{{ scope.row.p }}</span>
  356. </template>
  357. </el-table-column>
  358. <el-table-column label="产奶净能(%DM)" min-width="80px" align="center">
  359. <template slot-scope="scope">
  360. <span>{{ scope.row.n }}</span>
  361. </template>
  362. </el-table-column>
  363. <el-table-column label="脂肪(%DM)" min-width="70px" align="center">
  364. <template slot-scope="scope">
  365. <span>{{ scope.row.fat }}</span>
  366. </template>
  367. </el-table-column>
  368. <el-table-column label="ADF(%DM)" min-width="80px" align="center">
  369. <template slot-scope="scope">
  370. <span>{{ scope.row.adf }}</span>
  371. </template>
  372. </el-table-column>
  373. <el-table-column label="NDF(%DM)" min-width="80px" align="center">
  374. <template slot-scope="scope">
  375. <span>{{ scope.row.ndf }}</span>
  376. </template>
  377. </el-table-column>
  378. <el-table-column label="NDIP%" min-width="80px" align="center">
  379. <template slot-scope="scope">
  380. <span>{{ scope.row.ndip }}</span>
  381. </template>
  382. </el-table-column>
  383. <el-table-column label="粗灰分(Ash%)" min-width="70px" align="center">
  384. <template slot-scope="scope">
  385. <span>{{ scope.row.ash }}</span>
  386. </template>
  387. </el-table-column>
  388. <el-table-column label="粗料" min-width="70px" align="center">
  389. <template slot-scope="scope">
  390. <span>{{ scope.row.iscu }}</span>
  391. </template>
  392. </el-table-column>
  393. </el-table>
  394. </div>
  395. <div slot="footer" class="dialog-footer">
  396. <el-button class="cancel" @click="feedBank.dialogFormVisible = false; ">关闭</el-button>
  397. </div>
  398. </div>
  399. </el-dialog>
  400. <!-- 关联 -->
  401. <el-dialog :title="textMap[relation.dialogStatus]" :visible.sync="relation.dialogFormVisible" :close-on-click-modal="false" width="90%">
  402. <div class="app-add">
  403. <div class="search">
  404. <el-input v-model="relation.getdataListParm.parammaps.fname" placeholder="饲料名称" style="width: 130px;" class="filter-item" clearable />
  405. <el-button class="successBorder" @click="handleRelationSearch">查询</el-button>
  406. </div>
  407. <div class="table">
  408. <el-table
  409. :key="relation.tableKey"
  410. v-loading="relation.listLoading"
  411. element-loading-text="给我一点时间"
  412. :data="relation.list"
  413. border
  414. fit
  415. highlight-current-row
  416. style="width: 100%;margin: 0 auto 50px;"
  417. :row-style="rowStyle"
  418. :cell-style="cellStyle"
  419. class="elTable table-fixed"
  420. >
  421. <el-table-column label="序号" align="center" type="index" width="50px">
  422. <template slot-scope="scope">
  423. <span>{{ scope.$index + (relation.pageNum-1) * relation.pageSize + 1 }}</span>
  424. </template>
  425. </el-table-column>
  426. <el-table-column label="来源" min-width="90" align="center">
  427. <template slot-scope="scope">
  428. <span>{{ scope.row.sources }}</span>
  429. </template>
  430. </el-table-column>
  431. <el-table-column label="中国饲料号" min-width="100px" align="center">
  432. <template slot-scope="scope">
  433. <span>{{ scope.row.feedcode }}</span>
  434. </template>
  435. </el-table-column>
  436. <el-table-column label="饲料名称" min-width="90px" align="center">
  437. <template slot-scope="scope">
  438. <span>{{ scope.row.fname }}</span>
  439. </template>
  440. </el-table-column>
  441. <el-table-column label="价格" min-width="80px" align="center">
  442. <template slot-scope="scope">
  443. <span>{{ scope.row.price }}</span>
  444. </template>
  445. </el-table-column>
  446. <el-table-column label="样品说明" min-width="90px" align="center">
  447. <template slot-scope="scope">
  448. <span>{{ scope.row.remark }}</span>
  449. </template>
  450. </el-table-column>
  451. <el-table-column label="干物质(DM%)" min-width="70px" align="center">
  452. <template slot-scope="scope">
  453. <span>{{ scope.row.dry }}</span>
  454. </template>
  455. </el-table-column>
  456. <el-table-column label="淀粉(%DM)" min-width="70px" align="center">
  457. <template slot-scope="scope">
  458. <span>{{ scope.row.starch }}</span>
  459. </template>
  460. </el-table-column>
  461. <el-table-column label="粗蛋白(CP%DM)" min-width="75px" align="center">
  462. <template slot-scope="scope">
  463. <span>{{ scope.row.cp }}</span>
  464. </template>
  465. </el-table-column>
  466. <el-table-column label="钙(Ca%DM)" min-width="80px" align="center">
  467. <template slot-scope="scope">
  468. <span>{{ scope.row.ca }}</span>
  469. </template>
  470. </el-table-column>
  471. <el-table-column label="磷(P%DM)" min-width="80px" align="center">
  472. <template slot-scope="scope">
  473. <span>{{ scope.row.p }}</span>
  474. </template>
  475. </el-table-column>
  476. <el-table-column label="产奶净能(%DM)" min-width="80px" align="center">
  477. <template slot-scope="scope">
  478. <span>{{ scope.row.n }}</span>
  479. </template>
  480. </el-table-column>
  481. <el-table-column label="脂肪(%DM)" min-width="70px" align="center">
  482. <template slot-scope="scope">
  483. <span>{{ scope.row.fat }}</span>
  484. </template>
  485. </el-table-column>
  486. <el-table-column label="ADF(%DM)" min-width="80px" align="center">
  487. <template slot-scope="scope">
  488. <span>{{ scope.row.adf }}</span>
  489. </template>
  490. </el-table-column>
  491. <el-table-column label="NDF(%DM)" min-width="80px" align="center">
  492. <template slot-scope="scope">
  493. <span>{{ scope.row.ndf }}</span>
  494. </template>
  495. </el-table-column>
  496. <el-table-column label="NDIP%" min-width="80px" align="center">
  497. <template slot-scope="scope">
  498. <span>{{ scope.row.ndip }}</span>
  499. </template>
  500. </el-table-column>
  501. <el-table-column label="粗灰分(Ash%)" min-width="70px" align="center">
  502. <template slot-scope="scope">
  503. <span>{{ scope.row.ash }}</span>
  504. </template>
  505. </el-table-column>
  506. <el-table-column label="粗料" min-width="70px" align="center">
  507. <template slot-scope="scope">
  508. <span>{{ scope.row.iscu }}</span>
  509. </template>
  510. </el-table-column>
  511. <el-table-column label="操作" min-width="150px" align="center" class-name="small-padding fixed-width" fixed="right">
  512. <template slot-scope="{row}">
  513. <el-button v-if="row.statueRelation == '1'" class="miniSuccess" :disabled="isokDisable" @click="disassociateData(row)">取消关联</el-button>
  514. <el-button v-if="row.statueRelation == '0'" class="miniSuccess" :disabled="isokDisable" @click="relationData(row)">关联</el-button>
  515. </template>
  516. </el-table-column>
  517. </el-table>
  518. </div>
  519. <div slot="footer" class="dialog-footer">
  520. <el-button class="cancel" @click="relation.dialogFormVisible = false;getList() ">关闭</el-button>
  521. </div>
  522. </div>
  523. </el-dialog>
  524. <!-- 营养价值 -->
  525. <el-dialog :title="textMap[nutritive.dialogStatus]" :visible.sync="nutritive.dialogFormVisible" :close-on-click-modal="false" width="90%">
  526. <div class="app-add">
  527. <el-form ref="temp" :rules="nutritive.rules" :model="nutritive.temp" label-position="right" label-width="160px" style="width: 100%;margin:0 auto 50px">
  528. <el-row>
  529. <el-col :span="6">
  530. <el-form-item label="干物质(DM%):" prop="dry">
  531. <el-input ref="dry" v-model="nutritive.temp.dry" class="filter-item" placeholder="请输入干物质" type="text" />
  532. </el-form-item>
  533. </el-col>
  534. <el-col :span="6">
  535. <el-form-item label="淀粉(%DM):" prop="starch">
  536. <el-input ref="starch" v-model="nutritive.temp.starch" class="filter-item" placeholder="请输入淀粉" type="text" />
  537. </el-form-item>
  538. </el-col>
  539. <el-col :span="6">
  540. <el-form-item label="粗蛋白(CP%DM):" prop="cp">
  541. <el-input ref="cp" v-model="nutritive.temp.cp" class="filter-item" placeholder="请输入粗蛋白" type="text" />
  542. </el-form-item>
  543. </el-col>
  544. <el-col :span="6">
  545. <el-form-item label="钙(Ca%DM):" prop="ca">
  546. <el-input ref="ca" v-model="nutritive.temp.ca" class="filter-item" placeholder="请输入钙" type="text" />
  547. </el-form-item>
  548. </el-col>
  549. </el-row>
  550. <el-row>
  551. <el-col :span="6">
  552. <el-form-item label="磷(P%DM):" prop="p">
  553. <el-input ref="p" v-model="nutritive.temp.p" class="filter-item" placeholder="请输入磷" type="text" />
  554. </el-form-item>
  555. </el-col>
  556. <el-col :span="6">
  557. <el-form-item label="产奶净能(%DM):" prop="n">
  558. <el-input ref="n" v-model="nutritive.temp.n" class="filter-item" placeholder="请输入产奶净能" type="text" />
  559. </el-form-item>
  560. </el-col>
  561. <el-col :span="6">
  562. <el-form-item label="脂肪(%DM):" prop="fat">
  563. <el-input ref="fat" v-model="nutritive.temp.fat" class="filter-item" placeholder="请输入脂肪" type="text" />
  564. </el-form-item>
  565. </el-col>
  566. <el-col :span="6">
  567. <el-form-item label="ADF(%DM):" prop="adf">
  568. <el-input ref="adf" v-model="nutritive.temp.adf" class="filter-item" placeholder="请输入ADF" type="text" />
  569. </el-form-item>
  570. </el-col>
  571. </el-row>
  572. <el-row>
  573. <el-col :span="6">
  574. <el-form-item label="NDF(%DM):" prop="ndf">
  575. <el-input ref="ndf" v-model="nutritive.temp.ndf" class="filter-item" placeholder="请输入NDF" type="text" />
  576. </el-form-item>
  577. </el-col>
  578. <el-col :span="6">
  579. <el-form-item label="NDIP(%):" prop="ndip">
  580. <el-input ref="ndip" v-model="nutritive.temp.ndip" class="filter-item" placeholder="请输入NDIP" type="text" />
  581. </el-form-item>
  582. </el-col>
  583. <el-col :span="6">
  584. <el-form-item label="粗灰分(Ash%):" prop="ash">
  585. <el-input ref="ash" v-model="nutritive.temp.ash" class="filter-item" placeholder="请输入粗灰分" type="text" />
  586. </el-form-item>
  587. </el-col>
  588. </el-row>
  589. </el-form>
  590. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
  591. <el-button @click="nutritive.dialogFormVisible = false;getList()">关闭</el-button>
  592. <el-button v-if="nutritive.dialogStatus==='nutritive'" type="success" :disabled="isokDisable" @click="nutritiveData()">确认</el-button>
  593. </div>
  594. </div>
  595. </el-dialog>
  596. </div>
  597. </template>
  598. <script>
  599. import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames } from '@/api/common'
  600. import Cookies from 'js-cookie'
  601. import Pagination from '@/components/Pagination'
  602. import { MessageBox } from 'element-ui'
  603. export default {
  604. name: 'FeedTable',
  605. components: { Pagination },
  606. data() {
  607. return {
  608. requestParams: [
  609. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['跳转延时'] },
  610. { name: 'getFeedclassByBig', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  611. { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['计划类型'] }
  612. ],
  613. enableList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用
  614. feedSourcesList: [{ id: '0', name: '系统内置' }, { id: '1', name: '用户自定义' }], // 饲料来源
  615. confirmStartList: [{ id: '0', name: '禁用' }, { id: '1', name: '启用' }], // 确认开始
  616. associationStatusList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 关联状态
  617. jumpDelayList: [], // 跳转延时
  618. feedTypeList: [], // 饲料分类
  619. planTypeList: [], // 计划类型
  620. table: {
  621. tableKey: 0,
  622. list: [],
  623. total: 0,
  624. listLoading: true,
  625. getdataListParm: {
  626. name: 'getFeedList',
  627. page: 1,
  628. offset: 1,
  629. pagecount: 10,
  630. returntype: 'Map',
  631. parammaps: {
  632. pastureid: Cookies.get('pastureid'),
  633. fname: '',
  634. fclassid: '',
  635. source: '',
  636. autozone: '',
  637. autosecond: '',
  638. allowratio: '',
  639. printgroup: '',
  640. enable: ''
  641. }
  642. }
  643. },
  644. // 多项搜索显示隐藏
  645. arrowDown: true,
  646. arrowUp: false,
  647. // 新增/编辑
  648. create: {
  649. dialogFormVisible: false,
  650. dialogStatus: '',
  651. 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: '' },
  652. rules: {
  653. fname: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  654. fclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  655. feedcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  656. }
  657. },
  658. // 饲料库
  659. feedBank: {
  660. dialogFormVisible: false,
  661. dialogStatus: '',
  662. temp: {},
  663. rules: {},
  664. tableKey: 0,
  665. list: [],
  666. total: 0,
  667. listLoading: true,
  668. getdataListParm: {
  669. name: 'getFeednurList',
  670. page: 1,
  671. offset: 1,
  672. pagecount: 10,
  673. returntype: 'Map',
  674. parammaps: {
  675. pastureid: Cookies.get('pastureid'),
  676. fname: '',
  677. statue: ''
  678. }
  679. }
  680. },
  681. // 关联
  682. relation: {
  683. dialogFormVisible: false,
  684. dialogStatus: '',
  685. temp: {},
  686. rules: {},
  687. tableKey: 0,
  688. list: [],
  689. total: 0,
  690. listLoading: true,
  691. getdataListParm: {
  692. name: 'getFeednurRelation',
  693. page: 1,
  694. offset: 1,
  695. pagecount: 10,
  696. returntype: 'Map',
  697. parammaps: {
  698. pastureid: Cookies.get('pastureid'),
  699. fname: ''
  700. }
  701. }
  702. },
  703. // 营养价值
  704. nutritive: {
  705. dialogFormVisible: false,
  706. dialogStatus: '',
  707. temp: {},
  708. rules: {}
  709. },
  710. textMap: {
  711. create: '新增',
  712. update: '编辑',
  713. feedBank: '饲料库',
  714. relation: '关联',
  715. nutritive: '营养价值'
  716. },
  717. isokDisable: false,
  718. selectList: [],
  719. requestParam: {},
  720. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  721. cellStyle: { padding: 0 + 'px' }
  722. }
  723. },
  724. mounted() {
  725. document.addEventListener('click', (e) => {
  726. if (this.$refs.selectInput !== undefined) {
  727. if (!this.$refs.selectInput.contains(e.target)) {
  728. this.arrowDown = true
  729. this.arrowUp = false
  730. } else {
  731. this.arrowDown = false
  732. this.arrowUp = true
  733. }
  734. }
  735. })
  736. },
  737. created() {
  738. this.getList()
  739. this.getDownList()
  740. },
  741. methods: {
  742. getDownList() {
  743. GetDataByNames(this.requestParams).then(response => {
  744. this.jumpDelayList = response.data.getDictByName.list
  745. this.feedTypeList = response.data.getFeedclassByBig.list
  746. this.planTypeList = response.data.getDictByName2.list
  747. })
  748. },
  749. getList() {
  750. this.table.listLoading = true
  751. GetDataByName(this.table.getdataListParm).then(response => {
  752. console.log('table数据', response.data.list)
  753. if (response.data.list !== null) {
  754. this.table.list = response.data.list
  755. this.table.pageNum = response.data.pageNum
  756. this.table.pageSize = response.data.pageSize
  757. this.table.total = response.data.total
  758. } else {
  759. this.table.list = []
  760. }
  761. setTimeout(() => {
  762. this.table.listLoading = false
  763. }, 100)
  764. })
  765. },
  766. handleSearch() {
  767. console.log('点击了查询')
  768. this.table.getdataListParm.offset = 1
  769. this.getList()
  770. this.arrowDown = true
  771. this.arrowUp = false
  772. },
  773. handleRefresh() {
  774. console.log('点击了重置')
  775. this.table.getdataListParm.parammaps.fname = ''
  776. this.table.getdataListParm.parammaps.fclassid = ''
  777. this.table.getdataListParm.parammaps.source = ''
  778. this.table.getdataListParm.parammaps.autozone = ''
  779. this.table.getdataListParm.parammaps.autosecond = ''
  780. this.table.getdataListParm.parammaps.allowratio = ''
  781. this.table.getdataListParm.parammaps.printgroup = ''
  782. this.table.getdataListParm.parammaps.enable = ''
  783. this.table.getdataListParm.offset = 1
  784. this.getList()
  785. },
  786. resetTemp() {
  787. 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: '' }
  788. },
  789. // 计划类型
  790. changePlanList(item) {
  791. this.create.temp.printgroup = this.planTypeList.find(obj => obj.value === item).label
  792. },
  793. // 饲料类型
  794. changeFeedList(item) {
  795. this.create.temp.fclass = this.feedTypeList.find(obj => obj.id === item).mixname
  796. },
  797. // 跳转延时
  798. changeAutosecond(item) {
  799. this.create.temp.autosecondname = this.jumpDelayList.find(obj => obj.value === item).label
  800. },
  801. // 确认开始
  802. changeConfirmstart(item) {
  803. this.create.temp.confirmstartname = this.confirmStartList.find(obj => obj.id === item).name
  804. },
  805. // 新增
  806. handleCreate() {
  807. console.log('点击了新增')
  808. this.resetTemp()
  809. this.create.dialogStatus = 'create'
  810. this.create.dialogFormVisible = true
  811. },
  812. createData() {
  813. console.log('点击了新增保存')
  814. this.isokDisable = true
  815. setTimeout(() => {
  816. this.isokDisable = false
  817. }, 1000)
  818. this.$refs['temp'].validate(valid => {
  819. if (valid) {
  820. const unitweight = /^[1-9]\d*$/
  821. if (this.create.temp.unitweight !== '') {
  822. if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
  823. this.$message({ type: 'error', message: '包装单位重量请输入正整数', duration: 2000 })
  824. return false
  825. }
  826. }
  827. const uprice = /^\d+(\.\d{1,2})?$/
  828. if (this.create.temp.uprice !== '') {
  829. if (!uprice.test(parseFloat(this.create.temp.uprice))) {
  830. this.$message({ type: 'error', message: '单价请保留两位小数', duration: 2000 })
  831. return false
  832. }
  833. }
  834. const autozone = /^[1-9]\d*$/
  835. if (this.create.temp.autozone !== '') {
  836. if (!autozone.test(parseFloat(this.create.temp.autozone))) {
  837. this.$message({ type: 'error', message: '跳转重量域请输入正整数', duration: 2000 })
  838. return false
  839. }
  840. }
  841. const trgaddress = /(^[\-0-9][0-9]*(.[0-9]+)?)$/
  842. if (this.create.temp.trgaddress !== '') {
  843. if (!trgaddress.test(parseInt(this.create.temp.trgaddress))) {
  844. this.$message({ type: 'error', message: '继电器位置请输入1-8位数字', duration: 2000 })
  845. return false
  846. }
  847. }
  848. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  849. if (pattern.test(this.create.temp.fname)) {
  850. this.$message({ type: 'error', message: '饲料名称不可输入特殊字符', duration: 2000 })
  851. return false
  852. }
  853. const allowratio = /^[1-9]\d*$/
  854. if (this.create.temp.allowratio !== '') {
  855. if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
  856. this.$message({ type: 'error', message: '允许误差数请输入正整数', duration: 2000 })
  857. return false
  858. }
  859. }
  860. this.isokDisable = true
  861. setTimeout(() => {
  862. this.isokDisable = false
  863. }, 1000)
  864. this.requestParam.name = 'insertFeed'
  865. this.requestParam.parammaps = this.create.temp
  866. if (this.create.temp.allowratio == '') { this.create.temp.allowratio = '0' }
  867. if (this.create.temp.uprice == '') { this.create.temp.uprice = '0' }
  868. if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
  869. if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
  870. if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
  871. PostDataByName(this.requestParam).then(response => {
  872. console.log('新增保存发送参数', this.requestParam)
  873. if (response.msg !== 'fail') {
  874. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  875. this.create.dialogFormVisible = false
  876. this.getList()
  877. } else {
  878. failproccess(response, this.$notify)
  879. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  880. if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
  881. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  882. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  883. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  884. }
  885. })
  886. }
  887. })
  888. },
  889. // 编辑
  890. handleUpdate(row) {
  891. console.log('点击了编辑')
  892. this.create.dialogStatus = 'update'
  893. this.create.dialogFormVisible = true
  894. row.fclassid = String(row.fclassid)
  895. row.printgroupid = String(row.printgroupid)
  896. row.autosecond = String(row.autosecond)
  897. row.confirmstart = String(row.confirmstart)
  898. row.enable = String(row.enable)
  899. this.create.temp = Object.assign({}, row)
  900. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  901. if (this.create.temp.uprice == '0.00') { this.create.temp.uprice = '' }
  902. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  903. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  904. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  905. },
  906. updateData() {
  907. console.log('点击了编辑保存')
  908. this.isokDisable = true
  909. setTimeout(() => {
  910. this.isokDisable = false
  911. }, 1000)
  912. this.$refs['temp'].validate(valid => {
  913. if (valid) {
  914. const unitweight = /^[1-9]\d*$/
  915. if (this.create.temp.unitweight !== '') {
  916. if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
  917. this.$message({ type: 'error', message: '包装单位重量请输入正整数', duration: 2000 })
  918. return false
  919. }
  920. }
  921. const uprice = /^\d+(\.\d{1,2})?$/
  922. if (this.create.temp.uprice !== '') {
  923. if (!uprice.test(parseFloat(this.create.temp.uprice))) {
  924. this.$message({ type: 'error', message: '单价请保留两位小数', duration: 2000 })
  925. return false
  926. }
  927. }
  928. const autozone = /^[1-9]\d*$/
  929. if (this.create.temp.autozone !== '') {
  930. if (!autozone.test(parseFloat(this.create.temp.autozone))) {
  931. this.$message({ type: 'error', message: '跳转重量域请输入正整数', duration: 2000 })
  932. return false
  933. }
  934. }
  935. const trgaddress = /(^[\-0-9][0-9]*(.[0-9]+)?)$/
  936. if (this.create.temp.trgaddress !== '') {
  937. if (!trgaddress.test(parseInt(this.create.temp.trgaddress))) {
  938. this.$message({ type: 'error', message: '继电器位置请输入1-8位数字', duration: 2000 })
  939. return false
  940. }
  941. }
  942. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  943. if (pattern.test(this.create.temp.fname)) {
  944. this.$message({ type: 'error', message: '饲料名称不可输入特殊字符', duration: 2000 })
  945. return false
  946. }
  947. const allowratio = /^[1-9]\d*$/
  948. if (this.create.temp.allowratio !== '') {
  949. if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
  950. this.$message({ type: 'error', message: '允许误差数请输入正整数', duration: 2000 })
  951. return false
  952. }
  953. }
  954. this.isokDisable = true
  955. setTimeout(() => {
  956. this.isokDisable = false
  957. }, 1000)
  958. this.requestParam.name = 'updateFeed'
  959. this.requestParam.parammaps = this.create.temp
  960. if (this.create.temp.allowratio == '') { this.create.temp.allowratio = '0' }
  961. if (this.create.temp.uprice == '') { this.create.temp.uprice = '0' }
  962. if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
  963. if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
  964. if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
  965. PostDataByName(this.requestParam).then(response => {
  966. console.log('新增保存发送参数', this.requestParam)
  967. if (response.msg !== 'fail') {
  968. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  969. this.create.dialogFormVisible = false
  970. this.getList()
  971. } else {
  972. failproccess(response, this.$notify)
  973. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  974. if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
  975. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  976. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  977. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  978. }
  979. })
  980. }
  981. })
  982. },
  983. // 饲料库
  984. handleFeedBank() {
  985. console.log('点击了饲料库')
  986. this.feedBank.dialogStatus = 'feedBank'
  987. this.feedBank.dialogFormVisible = true
  988. this.getFeedBankList()
  989. },
  990. getFeedBankList() {
  991. this.feedBank.listLoading = true
  992. GetDataByName(this.feedBank.getdataListParm).then(response => {
  993. console.log('table数据', response.data.list)
  994. if (response.data.list !== null) {
  995. this.feedBank.list = response.data.list
  996. this.feedBank.pageNum = response.data.pageNum
  997. this.feedBank.pageSize = response.data.pageSize
  998. this.feedBank.total = response.data.total
  999. } else {
  1000. this.feedBank.list = []
  1001. }
  1002. setTimeout(() => {
  1003. this.feedBank.listLoading = false
  1004. }, 100)
  1005. })
  1006. },
  1007. handleFeedBankSearch() {
  1008. console.log('点击了饲料库搜索')
  1009. this.getFeedBankList()
  1010. this.feedBank.getdataListParm.offset = 1
  1011. },
  1012. handleFeedBankRefresh() {
  1013. console.log('点击了饲料库重置')
  1014. this.feedBank.getdataListParm.parammaps.fname = ''
  1015. this.feedBank.getdataListParm.parammaps.statue = ''
  1016. this.getFeedBankList()
  1017. },
  1018. // 关联
  1019. handleRelation(row) {
  1020. console.log('点击了关联')
  1021. this.relation.dialogStatus = 'relation'
  1022. this.relation.dialogFormVisible = true
  1023. this.relation.temp = Object.assign({}, row)
  1024. this.relation.getdataListParm.parammaps.fid = this.relation.temp.id
  1025. this.getRelationList()
  1026. },
  1027. getRelationList() {
  1028. this.relation.listLoading = true
  1029. GetDataByName(this.relation.getdataListParm).then(response => {
  1030. console.log('table数据', response.data.list)
  1031. if (response.data.list !== null) {
  1032. this.relation.list = response.data.list
  1033. this.relation.pageNum = response.data.pageNum
  1034. this.relation.pageSize = response.data.pageSize
  1035. this.relation.total = response.data.total
  1036. } else {
  1037. this.relation.list = []
  1038. }
  1039. setTimeout(() => {
  1040. this.relation.listLoading = false
  1041. }, 100)
  1042. })
  1043. },
  1044. handleRelationSearch() {
  1045. console.log('点击了关联搜索')
  1046. this.relation.getdataListParm.offset = 1
  1047. this.getRelationList()
  1048. },
  1049. disassociateData(row) {
  1050. console.log('点击了取消关联')
  1051. MessageBox.confirm('是否确认取消关联?', {
  1052. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1053. }).then(() => {
  1054. this.isokDisable = true
  1055. setTimeout(() => {
  1056. this.isokDisable = false
  1057. }, 1000)
  1058. this.requestParam.name = 'updateFeedrelation'
  1059. this.requestParam.parammaps = {}
  1060. this.requestParam.parammaps.pastureid = this.relation.temp.pastureid
  1061. this.requestParam.parammaps.fid = this.relation.temp.id
  1062. this.requestParam.parammaps.id = row.id
  1063. PostDataByName(this.requestParam).then(response => {
  1064. console.log('取消关联保存发送参数', this.requestParam)
  1065. if (response.msg !== 'fail') {
  1066. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1067. this.getRelationList()
  1068. this.getList()
  1069. } else {
  1070. failproccess(response, this.$notify)
  1071. }
  1072. })
  1073. }).catch(() => {
  1074. this.$message({ type: 'info', message: '已取消' })
  1075. })
  1076. },
  1077. relationData(row) {
  1078. console.log('点击了关联保存')
  1079. MessageBox.confirm('是否确认关联?', {
  1080. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1081. }).then(() => {
  1082. this.isokDisable = true
  1083. setTimeout(() => {
  1084. this.isokDisable = false
  1085. }, 1000)
  1086. this.requestParam.name = 'insertFeednur'
  1087. this.requestParam.parammaps = {}
  1088. this.requestParam.parammaps.pastureid = this.relation.temp.pastureid
  1089. this.requestParam.parammaps.fid = this.relation.temp.id
  1090. this.requestParam.parammaps.fname = this.relation.temp.fname
  1091. this.requestParam.parammaps.feedcode = this.relation.temp.feedcode
  1092. this.requestParam.parammaps.price = row.price
  1093. this.requestParam.parammaps.remark = row.remark
  1094. this.requestParam.parammaps.dry = row.dry
  1095. this.requestParam.parammaps.starch = row.starch
  1096. this.requestParam.parammaps.cp = row.cp
  1097. this.requestParam.parammaps.ca = row.ca
  1098. this.requestParam.parammaps.p = row.p
  1099. this.requestParam.parammaps.n = row.n
  1100. this.requestParam.parammaps.fat = row.fat
  1101. this.requestParam.parammaps.adf = row.adf
  1102. this.requestParam.parammaps.ndf = row.ndf
  1103. this.requestParam.parammaps.ndip = row.ndip
  1104. this.requestParam.parammaps.ash = row.ash
  1105. this.requestParam.parammaps.fpercent = row.fpercent
  1106. this.requestParam.parammaps.iscu = row.iscu
  1107. this.requestParam.parammaps.feednurid = row.id
  1108. PostDataByName(this.requestParam).then(response => {
  1109. console.log('关联保存发送参数', this.requestParam)
  1110. if (response.msg !== 'fail') {
  1111. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1112. this.getRelationList()
  1113. this.getList()
  1114. } else {
  1115. failproccess(response, this.$notify)
  1116. }
  1117. })
  1118. }).catch(() => {
  1119. this.$message({ type: 'info', message: '已取消' })
  1120. })
  1121. },
  1122. // 营养价值
  1123. handleNutritive(row) {
  1124. console.log('点击了营养价值', row)
  1125. this.nutritive.dialogStatus = 'nutritive'
  1126. this.nutritive.dialogFormVisible = true
  1127. this.nutritive.temp = Object.assign({}, row)
  1128. },
  1129. nutritiveData() {
  1130. console.log('点击了营养价值保存')
  1131. this.isokDisable = true
  1132. setTimeout(() => {
  1133. this.isokDisable = false
  1134. }, 1000)
  1135. this.requestParam.name = 'insertFeednur'
  1136. this.requestParam.parammaps = {}
  1137. this.requestParam.parammaps.pastureid = this.nutritive.temp.pastureid
  1138. this.requestParam.parammaps.fid = this.nutritive.temp.id
  1139. this.requestParam.parammaps.fname = this.nutritive.temp.fname
  1140. this.requestParam.parammaps.feedcode = this.nutritive.temp.feedcode
  1141. this.requestParam.parammaps.price = this.nutritive.temp.uprice
  1142. this.requestParam.parammaps.remark = this.nutritive.temp.remark
  1143. this.requestParam.parammaps.dry = this.nutritive.temp.dry
  1144. this.requestParam.parammaps.starch = this.nutritive.temp.starch
  1145. this.requestParam.parammaps.cp = this.nutritive.temp.cp
  1146. this.requestParam.parammaps.ca = this.nutritive.temp.ca
  1147. this.requestParam.parammaps.p = this.nutritive.temp.p
  1148. this.requestParam.parammaps.n = this.nutritive.temp.n
  1149. this.requestParam.parammaps.fat = this.nutritive.temp.fat
  1150. this.requestParam.parammaps.adf = this.nutritive.temp.adf
  1151. this.requestParam.parammaps.ndf = this.nutritive.temp.ndf
  1152. this.requestParam.parammaps.ndip = this.nutritive.temp.ndip
  1153. this.requestParam.parammaps.ash = this.nutritive.temp.ash
  1154. this.requestParam.parammaps.fpercent = this.nutritive.temp.fpercent
  1155. this.requestParam.parammaps.iscu = this.nutritive.temp.iscu
  1156. this.requestParam.parammaps.feednurid = '-1'
  1157. PostDataByName(this.requestParam).then(response => {
  1158. console.log('关联保存发送参数', this.requestParam)
  1159. if (response.msg !== 'fail') {
  1160. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1161. this.getList()
  1162. this.nutritive.dialogFormVisible = false
  1163. } else {
  1164. failproccess(response, this.$notify)
  1165. }
  1166. })
  1167. },
  1168. // 行内删除
  1169. handleRowDelete(row) {
  1170. console.log('点击了行内删除')
  1171. MessageBox.confirm('是否确认删除此信息?', {
  1172. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1173. }).then(() => {
  1174. this.requestParam.name = 'deleteFeed'
  1175. this.requestParam.parammaps = {}
  1176. this.requestParam.parammaps.pastureid = row.pastureid
  1177. this.requestParam.parammaps.id = row.id
  1178. PostDataByName(this.requestParam).then(() => {
  1179. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1180. this.getList()
  1181. })
  1182. }).catch(() => {
  1183. this.$message({ type: 'info', message: '已取消删除' })
  1184. })
  1185. },
  1186. handleSelectionChange(val) {
  1187. console.log('勾选数据', val)
  1188. this.selectList = val
  1189. },
  1190. // 多项删除
  1191. handleDelete() {
  1192. console.log('点击了删除')
  1193. if (this.selectList.length == 0) {
  1194. this.$message({ type: 'error', message: '请选择饲料表信息', duration: 2000 })
  1195. } else {
  1196. MessageBox.confirm('是否确认删除此信息?', {
  1197. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1198. }).then(() => {
  1199. console.log(this.selectList)
  1200. this.requestParam.common = { 'returnmap': '0' }
  1201. this.requestParam.data = []
  1202. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1203. this.requestParam.data[0].children = []
  1204. this.requestParam.data[0].children[0] = { 'name': 'deleteFeed', 'type': 'e', 'parammaps': {
  1205. id: '@insertSpotList.id',
  1206. pastureid: '@insertSpotList.pastureid'
  1207. }}
  1208. ExecDataByConfig(this.requestParam).then(response => {
  1209. console.log('删除保存发送参数', this.requestParam)
  1210. if (response.msg === 'fail') {
  1211. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1212. } else {
  1213. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1214. this.getList()
  1215. }
  1216. })
  1217. })
  1218. }
  1219. }
  1220. }
  1221. }
  1222. </script>
  1223. <style lang="scss" scoped>
  1224. .search{margin-top:10px;}
  1225. .table{margin-top:10px;}
  1226. $width:350px;
  1227. $left:325px;
  1228. .selectInput{
  1229. position: relative;
  1230. display: inline-block;
  1231. .Input{width: $width;position: relative;}
  1232. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  1233. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  1234. .selectUl{
  1235. 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;
  1236. li{
  1237. 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;
  1238. a{float:left;width: 80px;}
  1239. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  1240. }
  1241. }
  1242. }
  1243. </style>