059c6baf8b835159d1709650dfbbb1e6762f397e.svn-base 62 KB

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