6dbf10ed7f22435aae6da8c5fe50bafd3042398f.svn-base 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button v-if="isRoleEdit" class="success" style="float: left;margin-right:10px;" @click="handleCreate">新增</el-button>
  5. <el-button v-if="isRoleEdit" class="danger" style="float: left;margin-right:10px;" @click="handleDelete">删除</el-button>
  6. <el-button v-if="isRoleEdit" class="warning" style="float: left;margin-right:10px;" @click="handleCopy">复制</el-button>
  7. <el-button v-if="isRoleEdit" class="import" style="float: right;" @click="handleImport">导入</el-button>
  8. <el-dropdown style="float: right;margin-right: 10px;">
  9. <el-button class="export">导出</el-button>
  10. <el-dropdown-menu slot="dropdown">
  11. <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
  12. <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
  13. </el-dropdown-menu>
  14. </el-dropdown>
  15. </div>
  16. <div class="search">
  17. <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  18. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  19. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  20. <el-select v-model="table.getdataListParm.parammaps.barid" filterable placeholder="栏舍名称" class="filter-item" style="width: 120px;" clearable>
  21. <el-option v-for="item in houseNameList" :key="item.id" :label="item.bname" :value="item.id" />
  22. </el-select>
  23. <el-select v-model="table.getdataListParm.parammaps.cowclass" filterable placeholder="牲畜类别" class="filter-item" style="width: 120px;" clearable>
  24. <el-option v-for="item in livestockList" :key="item.id" :label="item.mixname" :value="item.classname" />
  25. </el-select>
  26. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  27. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  28. </div>
  29. <div class="table">
  30. <el-table
  31. :key="table.tableKey"
  32. v-loading="table.listLoading"
  33. element-loading-text="给我一点时间"
  34. :data="table.list"
  35. border
  36. fit
  37. highlight-current-row
  38. style="width: 100%;"
  39. :row-style="rowStyle"
  40. :cell-style="cellStyle"
  41. class="elTable table-fixed"
  42. @selection-change="handleSelectionChange"
  43. >
  44. <el-table-column type="selection" align="center" width="50" />
  45. <el-table-column label="序号" align="center" type="index" width="50px">
  46. <template slot-scope="scope">
  47. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="栏舍名称" min-width="150px" align="center">
  51. <template slot-scope="scope">
  52. <span>{{ scope.row.barname }}</span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="牲畜类别" min-width="150px" align="center">
  56. <template slot-scope="scope">
  57. <span>{{ scope.row.cowclass }}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="牛头数" min-width="90px" align="center">
  61. <template slot-scope="scope">
  62. <span>{{ scope.row.cowsum }}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="月龄" min-width="90px" align="center">
  66. <template slot-scope="scope">
  67. <span>{{ scope.row.avgmonthage }}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="体重(kg)" min-width="90px" align="center">
  71. <template slot-scope="scope">
  72. <span>{{ scope.row.bw }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="日增重(kg)" min-width="90px" align="center">
  76. <template slot-scope="scope">
  77. <span>{{ scope.row.dayw }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="胎次" min-width="80px" align="center">
  81. <template slot-scope="scope">
  82. <span>{{ scope.row.fetal }}</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="平均泌乳天数" min-width="110px" align="center">
  86. <template slot-scope="scope">
  87. <span>{{ scope.row.avgdim }}</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="怀孕天数" min-width="90px" align="center">
  91. <template slot-scope="scope">
  92. <span>{{ scope.row.dayspre }}</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="产奶量(kg/头)" min-width="110px" align="center">
  96. <template slot-scope="scope">
  97. <span>{{ scope.row.product }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="乳脂率(%)" min-width="90px" align="center">
  101. <template slot-scope="scope">
  102. <span>{{ scope.row.fat }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="乳蛋白率(%)" min-width="100px" align="center">
  106. <template slot-scope="scope">
  107. <span>{{ scope.row.pro }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="乳糖率(%)" min-width="90px" align="center">
  111. <template slot-scope="scope">
  112. <span>{{ scope.row.lactose }}</span>
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="温度(℃)" min-width="110px" align="center">
  116. <template slot-scope="scope">
  117. <span>{{ scope.row.tem }}</span>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="记录人" min-width="90px" align="center">
  121. <template slot-scope="scope">
  122. <span>{{ scope.row.emp }}</span>
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="生效时间" min-width="110px" align="center">
  126. <template slot-scope="scope">
  127. <span>{{ scope.row.productdate }}</span>
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  131. <template slot-scope="{row}">
  132. <el-button v-if="isRoleEdit" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  133. <el-button v-if="isRoleEdit" class="miniDanger" @click="handleRowDelete(row)">删除</el-button>
  134. </template>
  135. </el-table-column>
  136. </el-table>
  137. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  138. </div>
  139. <el-dialog :title="textMap[create.dialogStatus]" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="90%">
  140. <div class="app-add">
  141. <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="135px" style="width: 100%;margin:0 auto 50px">
  142. <el-row>
  143. <el-col :span="6">
  144. <el-form-item label="生效日期:" prop="productdate">
  145. <el-date-picker v-model="create.temp.productdate" type="date" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%;" :clearable="false" :disabled="create.dialogStatus=='update'" />
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="6">
  149. <el-form-item label="记录人:" prop="emp">
  150. <el-select ref="emp" v-model="create.temp.emp" :disabled="create.dialogStatus=='update'" filterable placeholder="记录人" class="filter-item" style="width: 100%;" @blur="blurEmp">
  151. <el-option v-for="item in create.noteTakerList" :key="item.myId" :label="item.emp" :value="item.emp" />
  152. </el-select>
  153. </el-form-item>
  154. </el-col>
  155. </el-row>
  156. <el-row>
  157. <el-col :span="24">
  158. <h3 style="width: 160px;text-align: right;">栏舍信息</h3>
  159. </el-col>
  160. </el-row>
  161. <el-row>
  162. <el-col :span="6">
  163. <el-form-item label="栏舍名称:" prop="barid">
  164. <el-select v-model="create.temp.barid" :disabled="create.dialogStatus=='update'" filterable placeholder="栏舍名称" class="filter-item" style="width: 100%;" @change="changeBar">
  165. <el-option v-for="item in houseNameList" :key="item.id" :label="item.bname" :value="item.id" />
  166. </el-select>
  167. </el-form-item>
  168. </el-col>
  169. <el-col :span="6">
  170. <el-form-item label="牲畜类别:" prop="cowclassid">
  171. <el-select v-model="create.temp.cowclassid" :disabled="create.dialogStatus=='update'" filterable placeholder="牲畜类别" class="filter-item" style="width: 100%;" @change="changeCowclass">
  172. <el-option v-for="item in livestockList" :key="item.id" :label="item.mixname" :value="item.id" />
  173. </el-select>
  174. </el-form-item>
  175. </el-col>
  176. <el-col :span="6">
  177. <el-form-item label="牛头数:" prop="cowsum">
  178. <el-input ref="cowsum" v-model="create.temp.cowsum" class="filter-item" placeholder="正整数" type="number" step="0.01" />
  179. </el-form-item>
  180. </el-col>
  181. <el-col :span="6">
  182. <el-form-item label="环境温度(℃):" prop="tem">
  183. <el-input v-model="create.temp.tem" class="filter-item" placeholder="最多两位小数" type="number" step="0.01" />
  184. </el-form-item>
  185. </el-col>
  186. </el-row>
  187. <el-row>
  188. <el-col :span="24">
  189. <h3 style="width: 160px;text-align: right;">牛只基础信息</h3>
  190. </el-col>
  191. </el-row>
  192. <el-row>
  193. <el-col :span="6">
  194. <el-form-item label="平均月龄:" prop="avgmonthage">
  195. <el-input ref="avgmonthage" v-model="create.temp.avgmonthage" class="filter-item" placeholder="最多两位小数" type="number" step="0.01" />
  196. </el-form-item>
  197. </el-col>
  198. <el-col :span="6">
  199. <el-form-item label="体重(kg):" prop="bw">
  200. <el-input ref="bw" v-model="create.temp.bw" class="filter-item" placeholder="最多两位小数" type="number" step="0.01" />
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="6">
  204. <el-form-item label="日增重(kg):" prop="dayw">
  205. <el-input ref="dayw" v-model="create.temp.dayw" class="filter-item" placeholder="最多两位小数" type="number" step="0.01" />
  206. </el-form-item>
  207. </el-col>
  208. <el-col :span="6">
  209. <el-form-item label="怀孕天数:" prop="dayspre">
  210. <el-input ref="dayspre" v-model="create.temp.dayspre" class="filter-item" placeholder="0-280整数" type="number" />
  211. </el-form-item>
  212. </el-col>
  213. </el-row>
  214. <el-row>
  215. <el-col :span="6">
  216. <el-form-item label="胎次:" prop="fetal">
  217. <el-input ref="fetal" v-model="create.temp.fetal" :disabled="create.temp.bigcowclass=='后备牛' " class="filter-item" placeholder="0-20整数" type="number" />
  218. </el-form-item>
  219. </el-col>
  220. <el-col :span="6">
  221. <el-form-item label="平均泌乳天数:" prop="avgdim">
  222. <el-input ref="avgdim" v-model="create.temp.avgdim" :disabled="create.temp.bigcowclass=='后备牛' || create.temp.bigcowclass=='干奶牛'" class="filter-item" placeholder="正整数" type="number" />
  223. </el-form-item>
  224. </el-col>
  225. <el-col :span="6">
  226. <el-form-item label="产奶量(kg/头):" prop="product">
  227. <el-input ref="product" v-model="create.temp.product" :disabled="create.temp.bigcowclass=='后备牛' || create.temp.bigcowclass=='干奶牛'" class="filter-item" placeholder="最多两位小数" type="number" />
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="6">
  231. <el-form-item label="乳脂率(%)" prop="fat">
  232. <el-input ref="fat" v-model="create.temp.fat" :disabled="create.temp.bigcowclass=='后备牛' || create.temp.bigcowclass=='干奶牛'" class="filter-item" placeholder="最多两位小数" type="number" />
  233. </el-form-item>
  234. </el-col>
  235. </el-row>
  236. <el-row>
  237. <el-col :span="6">
  238. <el-form-item label="乳蛋白率(%):" prop="pro">
  239. <el-input ref="pro" v-model="create.temp.pro" :disabled="create.temp.bigcowclass=='后备牛' || create.temp.bigcowclass=='干奶牛'" class="filter-item" placeholder="最多两位小数" type="number" />
  240. </el-form-item>
  241. </el-col>
  242. <el-col :span="6">
  243. <el-form-item label="乳糖率(%):" prop="lactose">
  244. <el-input ref="lactose" v-model="create.temp.lactose" :disabled="create.temp.bigcowclass=='后备牛' || create.temp.bigcowclass=='干奶牛'" class="filter-item" placeholder="最多两位小数" type="number" />
  245. </el-form-item>
  246. </el-col>
  247. </el-row>
  248. </el-form>
  249. <div slot="footer" class="dialog-footer">
  250. <el-button class="cancelClose" @click="create.dialogFormVisible = false;getList()">关闭</el-button>
  251. <el-button v-if="create.dialogStatus==='create'" class="success" :disabled="isokDisable" @click="createDataAgain()">确认新增</el-button>
  252. <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="success" :disabled="isokDisable" @click="create.dialogStatus==='create'?createData():updateData()">确认</el-button>
  253. </div>
  254. </div>
  255. </el-dialog>
  256. </div>
  257. </template>
  258. <script>
  259. import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames, checkButtons } from '@/api/common'
  260. import Cookies from 'js-cookie'
  261. import { parseTime } from '@/utils/index.js'
  262. import Pagination from '@/components/Pagination'
  263. import { MessageBox } from 'element-ui'
  264. export default {
  265. name: 'Performance',
  266. components: { Pagination },
  267. data() {
  268. return {
  269. isRoleEdit: [],
  270. requestParams: [
  271. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }},
  272. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }}
  273. ],
  274. houseNameList: [], // 栏舍名称
  275. livestockList: [], // 牲畜类别
  276. table: {
  277. getdataListParm: {
  278. name: 'getBarmilkList',
  279. page: 1,
  280. offset: 1,
  281. pagecount: 10,
  282. returntype: 'Map',
  283. parammaps: {
  284. pastureid: Cookies.get('pastureid'),
  285. barid: '',
  286. cowclass: '',
  287. startTime: '',
  288. stopTime: '',
  289. inputDatetime: ''
  290. }
  291. },
  292. tableKey: 0,
  293. list: [],
  294. total: 0,
  295. listLoading: true,
  296. temp: {}
  297. },
  298. // 新增/编辑
  299. create: {
  300. dialogFormVisible: false,
  301. dialogStatus: '',
  302. temp: { pastureid: Cookies.get('pastureid'), productdate: parseTime(new Date(), '{y}-{m}-{d}'), emp: Cookies.get('employename'), barid: '', barname: '', cowclassid: '', cowclass: '', bigcowclass: '', cowsum: '', tem: '', avgmonthage: '', bw: '', dayw: '', dayspre: '', fetal: '', avgdim: '', product: '', fat: '', pro: '', lactose: '' },
  303. rules: {
  304. barid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  305. cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  306. },
  307. getdataListParm: {
  308. name: 'getBarmilkEmpHis',
  309. page: 1,
  310. offset: 1,
  311. pagecount: 10,
  312. returntype: 'Map',
  313. parammaps: {
  314. pastureid: Cookies.get('pastureid')
  315. }
  316. },
  317. noteTakerList: [] // 记录人
  318. },
  319. textMap: {
  320. create: '新增',
  321. update: '编辑'
  322. },
  323. requestParam: {},
  324. isokDisable: false,
  325. selectList: [],
  326. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  327. cellStyle: { padding: 0 + 'px' }
  328. }
  329. },
  330. created() {
  331. this.getList()
  332. this.getDownList()
  333. this.getButtons()
  334. },
  335. methods: {
  336. getButtons() {
  337. const Edit = 'Performance'
  338. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  339. this.isRoleEdit = isRoleEdit
  340. },
  341. getDownList() {
  342. GetDataByNames(this.requestParams).then(response => {
  343. this.houseNameList = response.data.getBarListEnable.list
  344. this.livestockList = response.data.getCowclassListEnable.list
  345. })
  346. },
  347. handleBefore() {
  348. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  349. var start = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() - 1))
  350. var stop = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() - 1))
  351. this.table.getdataListParm.parammaps.inputDatetime.length = 0
  352. this.table.getdataListParm.parammaps.inputDatetime.push(start, stop)
  353. this.$forceUpdate()
  354. }
  355. },
  356. handleNext() {
  357. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  358. var start = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() + 1))
  359. var stop = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() + 1))
  360. this.table.getdataListParm.parammaps.inputDatetime.length = 0
  361. this.table.getdataListParm.parammaps.inputDatetime.push(start, stop)
  362. this.$forceUpdate()
  363. }
  364. },
  365. getList() {
  366. this.table.listLoading = true
  367. GetDataByName(this.table.getdataListParm).then(response => {
  368. console.log('table数据', response.data.list)
  369. if (response.data.list !== null) {
  370. this.table.list = response.data.list
  371. this.table.pageNum = response.data.pageNum
  372. this.table.pageSize = response.data.pageSize
  373. this.table.total = response.data.total
  374. } else {
  375. this.table.list = []
  376. }
  377. setTimeout(() => {
  378. this.table.listLoading = false
  379. }, 100)
  380. })
  381. },
  382. handleSearch() {
  383. console.log('点击了查询')
  384. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  385. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  386. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  387. } else {
  388. this.table.getdataListParm.parammaps.inputDatetime = ''
  389. this.table.getdataListParm.parammaps.startTime = ''
  390. this.table.getdataListParm.parammaps.stopTime = ''
  391. }
  392. this.table.getdataListParm.offset = 1
  393. this.getList()
  394. },
  395. handleRefresh() {
  396. console.log('点击了重置')
  397. this.table.getdataListParm.parammaps.barid = ''
  398. this.table.getdataListParm.parammaps.cowclass = ''
  399. this.table.getdataListParm.parammaps.startTime = ''
  400. this.table.getdataListParm.parammaps.stopTime = ''
  401. this.table.getdataListParm.parammaps.inputDatetime = ''
  402. this.table.getdataListParm.offset = 1
  403. this.getList()
  404. },
  405. // 新增
  406. resetTemp() {
  407. this.create.temp = { pastureid: Cookies.get('pastureid'), productdate: parseTime(new Date(), '{y}-{m}-{d}'), emp: Cookies.get('employename'), barid: '', barname: '', cowclassid: '', cowclass: '', bigcowclass: '', cowsum: '', tem: '', avgmonthage: '', bw: '', dayw: '', dayspre: '', fetal: '', avgdim: '', product: '', fat: '', pro: '', lactose: '' }
  408. },
  409. blurEmp(item) {
  410. this.create.temp.emp = item.target.value
  411. },
  412. // 栏舍名称
  413. changeBar(item) {
  414. this.create.temp.barname = this.houseNameList.find(obj => obj.id === item).bname
  415. },
  416. // 牲畜类别
  417. changeCowclass(item) {
  418. this.create.temp.cowclass = this.livestockList.find(obj => obj.id === item).classname
  419. this.create.temp.bigcowclass = this.livestockList.find(obj => obj.id === item).parentname
  420. },
  421. getNoteTakerList() {
  422. GetDataByName(this.create.getdataListParm).then(response => {
  423. if (response.data.list !== null) {
  424. for (let i = 0; i < response.data.list.length; i++) {
  425. response.data.list[i].myId = i
  426. }
  427. this.create.noteTakerList = response.data.list
  428. console.log('记录人数据', response.data.list)
  429. console.log(this.create.noteTakerList)
  430. } else {
  431. this.create.noteTakerList = []
  432. }
  433. })
  434. },
  435. handleCreate() {
  436. console.log('点击了新增')
  437. this.resetTemp()
  438. this.getNoteTakerList()
  439. this.create.dialogStatus = 'create'
  440. this.create.dialogFormVisible = true
  441. },
  442. createData() {
  443. console.log('点击了新增保存')
  444. this.isokDisable = true
  445. setTimeout(() => {
  446. this.isokDisable = false
  447. }, 1000)
  448. this.$refs['temp'].validate(valid => {
  449. if (valid) {
  450. this.isokDisable = true
  451. setTimeout(() => {
  452. this.isokDisable = false
  453. }, 1000)
  454. const positiveInteger = /^[1-9]\d*$/
  455. // 牛头数
  456. if (this.create.temp.cowsum !== '') {
  457. if (!positiveInteger.test(parseFloat(this.create.temp.cowsum))) {
  458. this.$message({ type: 'error', message: '牛头数请输入正整数', duration: 2000 })
  459. return false
  460. }
  461. }
  462. const twoDecimalPlaces = /^\d+(\.\d{1,2})?$/
  463. // 温度环境
  464. if (this.create.temp.tem !== '') {
  465. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.tem))) {
  466. this.$message({ type: 'error', message: '温度环境请保留两位小数', duration: 2000 })
  467. return false
  468. }
  469. }
  470. // 平均月龄
  471. if (this.create.temp.avgmonthage !== '') {
  472. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.avgmonthage))) {
  473. this.$message({ type: 'error', message: '平均月龄请保留两位小数', duration: 2000 })
  474. return false
  475. }
  476. }
  477. // 体重
  478. if (this.create.temp.bw !== '') {
  479. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.bw))) {
  480. this.$message({ type: 'error', message: '体重请保留两位小数', duration: 2000 })
  481. return false
  482. }
  483. }
  484. // 日增重
  485. if (this.create.temp.dayw !== '') {
  486. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.dayw))) {
  487. this.$message({ type: 'error', message: '日增重请保留两位小数', duration: 2000 })
  488. return false
  489. }
  490. }
  491. const dayspre = /^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-7]\d|7[0-9]))))$/
  492. // 怀孕天数
  493. if (this.create.temp.dayspre !== '') {
  494. if (!dayspre.test(parseFloat(this.create.temp.dayspre))) {
  495. this.$message({ type: 'error', message: '怀孕天数请输入大于0小于280整数', duration: 2000 })
  496. return false
  497. }
  498. }
  499. const fetal = /^(?:[0-9]|1[0-9])$/
  500. // 胎次
  501. if (this.create.temp.fetal !== '') {
  502. if (!fetal.test(parseFloat(this.create.temp.fetal))) {
  503. this.$message({ type: 'error', message: '胎次请输入大于0小于20整数', duration: 2000 })
  504. return false
  505. }
  506. }
  507. // 平均泌乳
  508. if (this.create.temp.avgdim !== '') {
  509. if (!positiveInteger.test(parseFloat(this.create.temp.avgdim))) {
  510. this.$message({ type: 'error', message: '平均泌乳天数请输入正整数', duration: 2000 })
  511. return false
  512. }
  513. }
  514. // 产奶量
  515. if (this.create.temp.product !== '') {
  516. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.product))) {
  517. this.$message({ type: 'error', message: '产奶量请保留两位小数', duration: 2000 })
  518. return false
  519. }
  520. }
  521. // 乳脂率
  522. if (this.create.temp.fat !== '') {
  523. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.fat))) {
  524. this.$message({ type: 'error', message: '乳脂率请保留两位小数', duration: 2000 })
  525. return false
  526. }
  527. }
  528. // 乳蛋白率
  529. if (this.create.temp.pro !== '') {
  530. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.pro))) {
  531. this.$message({ type: 'error', message: '乳蛋白率请保留两位小数', duration: 2000 })
  532. return false
  533. }
  534. }
  535. // 乳糖率
  536. if (this.create.temp.lactose !== '') {
  537. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.lactose))) {
  538. this.$message({ type: 'error', message: '乳糖率请保留两位小数', duration: 2000 })
  539. return false
  540. }
  541. }
  542. this.requestParam.name = 'insertBarmilk'
  543. this.requestParam.parammaps = this.create.temp
  544. if (this.create.temp.cowsum == '') { this.create.temp.cowsum = '0' }
  545. if (this.create.temp.tem == '') { this.create.temp.tem = '0' }
  546. if (this.create.temp.avgmonthage == '') { this.create.temp.avgmonthage = '0' }
  547. if (this.create.temp.bw == '') { this.create.temp.bw = '0' }
  548. if (this.create.temp.dayw == '') { this.create.temp.dayw = '0' }
  549. if (this.create.temp.dayspre == '') { this.create.temp.dayspre = '0' }
  550. if (this.create.temp.fetal == '') { this.create.temp.fetal = '0' }
  551. if (this.create.temp.avgdim == '') { this.create.temp.avgdim = '0' }
  552. if (this.create.temp.product == '') { this.create.temp.product = '0' }
  553. if (this.create.temp.fat == '') { this.create.temp.fat = '0' }
  554. if (this.create.temp.pro == '') { this.create.temp.pro = '0' }
  555. if (this.create.temp.lactose == '') { this.create.temp.lactose = '0' }
  556. PostDataByName(this.requestParam).then(response => {
  557. console.log('新增保存发送参数', this.requestParam)
  558. if (response.msg !== 'fail') {
  559. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  560. this.create.dialogFormVisible = false
  561. this.getList()
  562. } else {
  563. const barid = new RegExp("key 'barid'")
  564. if (barid.test(response.data)) {
  565. this.$message({ type: 'error', message: '该栏舍今日生产性能已存在,不可重复生成', duration: 2000 })
  566. } else {
  567. failproccess(response, this.$notify)
  568. }
  569. if (this.create.temp.cowsum == '0') { this.create.temp.cowsum = '' }
  570. if (this.create.temp.tem == '0') { this.create.temp.tem = '' }
  571. if (this.create.temp.avgmonthage == '0') { this.create.temp.avgmonthage = '' }
  572. if (this.create.temp.bw == '0') { this.create.temp.bw = '' }
  573. if (this.create.temp.dayw == '0') { this.create.temp.dayw = '' }
  574. if (this.create.temp.dayspre == '0') { this.create.temp.dayspre = '' }
  575. if (this.create.temp.fetal == '0') { this.create.temp.fetal = '' }
  576. if (this.create.temp.avgdim == '0') { this.create.temp.avgdim = '' }
  577. if (this.create.temp.product == '0') { this.create.temp.product = '' }
  578. if (this.create.temp.fat == '0') { this.create.temp.fat = '' }
  579. if (this.create.temp.pro == '0') { this.create.temp.pro = '' }
  580. if (this.create.temp.lactose == '0') { this.create.temp.lactose = '' }
  581. }
  582. })
  583. }
  584. })
  585. },
  586. createDataAgain() {
  587. console.log('点击了新增保存')
  588. this.isokDisable = true
  589. setTimeout(() => {
  590. this.isokDisable = false
  591. }, 1000)
  592. this.$refs['temp'].validate(valid => {
  593. if (valid) {
  594. this.isokDisable = true
  595. setTimeout(() => {
  596. this.isokDisable = false
  597. }, 1000)
  598. const positiveInteger = /^[1-9]\d*$/
  599. // 牛头数
  600. if (this.create.temp.cowsum !== '') {
  601. if (!positiveInteger.test(parseFloat(this.create.temp.cowsum))) {
  602. this.$message({ type: 'error', message: '牛头数请输入正整数', duration: 2000 })
  603. return false
  604. }
  605. }
  606. const twoDecimalPlaces = /^\d+(\.\d{1,2})?$/
  607. // 温度环境
  608. if (this.create.temp.tem !== '') {
  609. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.tem))) {
  610. this.$message({ type: 'error', message: '温度环境请保留两位小数', duration: 2000 })
  611. return false
  612. }
  613. }
  614. // 平均月龄
  615. if (this.create.temp.avgmonthage !== '') {
  616. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.avgmonthage))) {
  617. this.$message({ type: 'error', message: '平均月龄请保留两位小数', duration: 2000 })
  618. return false
  619. }
  620. }
  621. // 体重
  622. if (this.create.temp.bw !== '') {
  623. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.bw))) {
  624. this.$message({ type: 'error', message: '体重请保留两位小数', duration: 2000 })
  625. return false
  626. }
  627. }
  628. // 日增重
  629. if (this.create.temp.dayw !== '') {
  630. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.dayw))) {
  631. this.$message({ type: 'error', message: '日增重请保留两位小数', duration: 2000 })
  632. return false
  633. }
  634. }
  635. const dayspre = /^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-7]\d|7[0-9]))))$/
  636. // 怀孕天数
  637. if (this.create.temp.dayspre !== '') {
  638. if (!dayspre.test(parseFloat(this.create.temp.dayspre))) {
  639. this.$message({ type: 'error', message: '怀孕天数请输入大于0小于280整数', duration: 2000 })
  640. return false
  641. }
  642. }
  643. const fetal = /^(?:[0-9]|1[0-9])$/
  644. // 胎次
  645. if (this.create.temp.fetal !== '') {
  646. if (!fetal.test(parseFloat(this.create.temp.fetal))) {
  647. this.$message({ type: 'error', message: '胎次请输入大于0小于20整数', duration: 2000 })
  648. return false
  649. }
  650. }
  651. // 平均泌乳
  652. if (this.create.temp.avgdim !== '') {
  653. if (!positiveInteger.test(parseFloat(this.create.temp.avgdim))) {
  654. this.$message({ type: 'error', message: '平均泌乳天数请输入正整数', duration: 2000 })
  655. return false
  656. }
  657. }
  658. // 产奶量
  659. if (this.create.temp.product !== '') {
  660. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.product))) {
  661. this.$message({ type: 'error', message: '产奶量请保留两位小数', duration: 2000 })
  662. return false
  663. }
  664. }
  665. // 乳脂率
  666. if (this.create.temp.fat !== '') {
  667. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.fat))) {
  668. this.$message({ type: 'error', message: '乳脂率请保留两位小数', duration: 2000 })
  669. return false
  670. }
  671. }
  672. // 乳蛋白率
  673. if (this.create.temp.pro !== '') {
  674. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.pro))) {
  675. this.$message({ type: 'error', message: '乳蛋白率请保留两位小数', duration: 2000 })
  676. return false
  677. }
  678. }
  679. // 乳糖率
  680. if (this.create.temp.lactose !== '') {
  681. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.lactose))) {
  682. this.$message({ type: 'error', message: '乳糖率请保留两位小数', duration: 2000 })
  683. return false
  684. }
  685. }
  686. this.requestParam.name = 'insertBarmilk'
  687. this.requestParam.parammaps = this.create.temp
  688. if (this.create.temp.cowsum == '') { this.create.temp.cowsum = '0' }
  689. if (this.create.temp.tem == '') { this.create.temp.tem = '0' }
  690. if (this.create.temp.avgmonthage == '') { this.create.temp.avgmonthage = '0' }
  691. if (this.create.temp.bw == '') { this.create.temp.bw = '0' }
  692. if (this.create.temp.dayw == '') { this.create.temp.dayw = '0' }
  693. if (this.create.temp.dayspre == '') { this.create.temp.dayspre = '0' }
  694. if (this.create.temp.fetal == '') { this.create.temp.fetal = '0' }
  695. if (this.create.temp.avgdim == '') { this.create.temp.avgdim = '0' }
  696. if (this.create.temp.product == '') { this.create.temp.product = '0' }
  697. if (this.create.temp.fat == '') { this.create.temp.fat = '0' }
  698. if (this.create.temp.pro == '') { this.create.temp.pro = '0' }
  699. if (this.create.temp.lactose == '') { this.create.temp.lactose = '0' }
  700. PostDataByName(this.requestParam).then(response => {
  701. console.log('新增保存发送参数', this.requestParam)
  702. if (response.msg !== 'fail') {
  703. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  704. this.resetTemp()
  705. this.create.noteTakerList = []
  706. this.getNoteTakerList()
  707. } else {
  708. const barid = new RegExp("key 'barid'")
  709. if (barid.test(response.data)) {
  710. this.$message({ type: 'error', message: '该栏舍今日生产性能已存在,不可重复生成', duration: 2000 })
  711. } else {
  712. failproccess(response, this.$notify)
  713. }
  714. if (this.create.temp.cowsum == '0') { this.create.temp.cowsum = '' }
  715. if (this.create.temp.tem == '0') { this.create.temp.tem = '' }
  716. if (this.create.temp.avgmonthage == '0') { this.create.temp.avgmonthage = '' }
  717. if (this.create.temp.bw == '0') { this.create.temp.bw = '' }
  718. if (this.create.temp.dayw == '0') { this.create.temp.dayw = '' }
  719. if (this.create.temp.dayspre == '0') { this.create.temp.dayspre = '' }
  720. if (this.create.temp.fetal == '0') { this.create.temp.fetal = '' }
  721. if (this.create.temp.avgdim == '0') { this.create.temp.avgdim = '' }
  722. if (this.create.temp.product == '0') { this.create.temp.product = '' }
  723. if (this.create.temp.fat == '0') { this.create.temp.fat = '' }
  724. if (this.create.temp.pro == '0') { this.create.temp.pro = '' }
  725. if (this.create.temp.lactose == '0') { this.create.temp.lactose = '' }
  726. }
  727. })
  728. }
  729. })
  730. },
  731. // 编辑
  732. handleUpdate(row) {
  733. console.log('点击了编辑', row)
  734. row.barid = String(row.barid)
  735. row.cowclassid = String(row.cowclassid)
  736. this.create.temp = Object.assign({}, row)
  737. this.create.temp.id = row.id
  738. if (this.create.temp.cowsum == '0') { this.create.temp.cowsum = '' }
  739. if (this.create.temp.avgdim == '0') { this.create.temp.avgdim = '' }
  740. this.getNoteTakerList()
  741. this.create.dialogStatus = 'update'
  742. this.create.dialogFormVisible = true
  743. },
  744. updateData() {
  745. this.isokDisable = true
  746. setTimeout(() => {
  747. this.isokDisable = false
  748. }, 1000)
  749. this.$refs['temp'].validate(valid => {
  750. if (valid) {
  751. this.isokDisable = true
  752. setTimeout(() => {
  753. this.isokDisable = false
  754. }, 1000)
  755. const positiveInteger = /^[1-9]\d*$/
  756. // 牛头数
  757. if (this.create.temp.cowsum !== '') {
  758. if (!positiveInteger.test(parseFloat(this.create.temp.cowsum))) {
  759. this.$message({ type: 'error', message: '牛头数请输入正整数', duration: 2000 })
  760. return false
  761. }
  762. }
  763. const twoDecimalPlaces = /^\d+(\.\d{1,2})?$/
  764. // 温度环境
  765. if (this.create.temp.tem !== '') {
  766. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.tem))) {
  767. this.$message({ type: 'error', message: '温度环境请保留两位小数', duration: 2000 })
  768. return false
  769. }
  770. }
  771. // 平均月龄
  772. if (this.create.temp.avgmonthage !== '') {
  773. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.avgmonthage))) {
  774. this.$message({ type: 'error', message: '平均月龄请保留两位小数', duration: 2000 })
  775. return false
  776. }
  777. }
  778. // 体重
  779. if (this.create.temp.bw !== '') {
  780. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.bw))) {
  781. this.$message({ type: 'error', message: '体重请保留两位小数', duration: 2000 })
  782. return false
  783. }
  784. }
  785. // 日增重
  786. if (this.create.temp.dayw !== '') {
  787. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.dayw))) {
  788. this.$message({ type: 'error', message: '日增重请保留两位小数', duration: 2000 })
  789. return false
  790. }
  791. }
  792. const dayspre = /^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-7]\d|7[0-9]))))$/
  793. // 怀孕天数
  794. if (this.create.temp.dayspre !== '') {
  795. if (!dayspre.test(parseFloat(this.create.temp.dayspre))) {
  796. this.$message({ type: 'error', message: '怀孕天数请输入大于0小于280整数', duration: 2000 })
  797. return false
  798. }
  799. }
  800. const fetal = /^(?:[0-9]|1[0-9])$/
  801. // 胎次
  802. if (this.create.temp.fetal !== '') {
  803. if (!fetal.test(parseFloat(this.create.temp.fetal))) {
  804. this.$message({ type: 'error', message: '胎次请输入大于0小于20整数', duration: 2000 })
  805. return false
  806. }
  807. }
  808. // 平均泌乳
  809. if (this.create.temp.avgdim !== '') {
  810. if (!positiveInteger.test(parseFloat(this.create.temp.avgdim))) {
  811. this.$message({ type: 'error', message: '平均泌乳天数请输入正整数', duration: 2000 })
  812. return false
  813. }
  814. }
  815. // 产奶量
  816. if (this.create.temp.product !== '') {
  817. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.product))) {
  818. this.$message({ type: 'error', message: '产奶量请保留两位小数', duration: 2000 })
  819. return false
  820. }
  821. }
  822. // 乳脂率
  823. if (this.create.temp.fat !== '') {
  824. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.fat))) {
  825. this.$message({ type: 'error', message: '乳脂率请保留两位小数', duration: 2000 })
  826. return false
  827. }
  828. }
  829. // 乳蛋白率
  830. if (this.create.temp.pro !== '') {
  831. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.pro))) {
  832. this.$message({ type: 'error', message: '乳蛋白率请保留两位小数', duration: 2000 })
  833. return false
  834. }
  835. }
  836. // 乳糖率
  837. if (this.create.temp.lactose !== '') {
  838. if (!twoDecimalPlaces.test(parseFloat(this.create.temp.lactose))) {
  839. this.$message({ type: 'error', message: '乳糖率请保留两位小数', duration: 2000 })
  840. return false
  841. }
  842. }
  843. this.requestParam.name = 'updateBarmilk'
  844. this.requestParam.parammaps = this.create.temp
  845. if (this.create.temp.cowsum == '') { this.create.temp.cowsum = '0' }
  846. if (this.create.temp.tem == '') { this.create.temp.tem = '0' }
  847. if (this.create.temp.avgmonthage == '') { this.create.temp.avgmonthage = '0' }
  848. if (this.create.temp.bw == '') { this.create.temp.bw = '0' }
  849. if (this.create.temp.dayw == '') { this.create.temp.dayw = '0' }
  850. if (this.create.temp.dayspre == '') { this.create.temp.dayspre = '0' }
  851. if (this.create.temp.fetal == '') { this.create.temp.fetal = '0' }
  852. if (this.create.temp.avgdim == '') { this.create.temp.avgdim = '0' }
  853. if (this.create.temp.product == '') { this.create.temp.product = '0' }
  854. if (this.create.temp.fat == '') { this.create.temp.fat = '0' }
  855. if (this.create.temp.pro == '') { this.create.temp.pro = '0' }
  856. if (this.create.temp.lactose == '') { this.create.temp.lactose = '0' }
  857. PostDataByName(this.requestParam).then(response => {
  858. console.log('新增保存发送参数', this.requestParam)
  859. if (response.msg !== 'fail') {
  860. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  861. this.create.dialogFormVisible = false
  862. this.getList()
  863. } else {
  864. failproccess(response, this.$notify)
  865. if (this.create.temp.dayspre == '0') { this.create.temp.dayspre = '' }
  866. if (this.create.temp.fetal == '0') { this.create.temp.fetal = '' }
  867. if (this.create.temp.cowsum == '0') { this.create.temp.cowsum = '' }
  868. if (this.create.temp.avgdim == '0') { this.create.temp.avgdim = '' }
  869. }
  870. })
  871. }
  872. })
  873. },
  874. // 删除
  875. handleRowDelete(row) {
  876. console.log('点击了行内删除')
  877. MessageBox.confirm('是否确认删除此信息?', {
  878. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  879. }).then(() => {
  880. this.selectList = []
  881. this.requestParam.name = 'deleteBarmilk'
  882. this.requestParam.parammaps = {}
  883. this.requestParam.parammaps.pastureid = row.pastureid
  884. this.requestParam.parammaps.id = row.id
  885. PostDataByName(this.requestParam).then(response => {
  886. if (response.msg === 'fail') {
  887. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  888. } else {
  889. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  890. this.getList()
  891. }
  892. })
  893. }).catch(() => {
  894. this.$message({ type: 'info', message: '已取消删除' })
  895. })
  896. },
  897. handleSelectionChange(val) {
  898. console.log('勾选数据', val)
  899. this.selectList = val
  900. },
  901. handleDelete() {
  902. console.log('点击了删除')
  903. if (this.selectList.length == 0) {
  904. this.$message({ type: 'error', message: '请选择栏舍生产性能', duration: 2000 })
  905. } else {
  906. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  907. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  908. }).then(() => {
  909. console.log(this.selectList)
  910. this.requestParam.common = { 'returnmap': '0' }
  911. this.requestParam.data = []
  912. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  913. this.requestParam.data[0].children = []
  914. this.requestParam.data[0].children[0] = { 'name': 'deleteBarmilk', 'type': 'e', 'parammaps': {
  915. id: '@insertSpotList.id',
  916. pastureid: '@insertSpotList.pastureid'
  917. }}
  918. ExecDataByConfig(this.requestParam).then(response => {
  919. console.log('删除保存发送参数', this.requestParam)
  920. if (response.msg === 'fail') {
  921. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  922. } else {
  923. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  924. this.getList()
  925. }
  926. })
  927. })
  928. }
  929. },
  930. // 复制
  931. handleCopy() {
  932. console.log('点击了复制')
  933. if (this.selectList.length == 0) {
  934. this.$message({ type: 'error', message: '请选择栏舍生产性能', duration: 2000 })
  935. } else if (this.selectList.length == 1) {
  936. MessageBox.confirm('是否确认复制此信息?', {
  937. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  938. }).then(() => {
  939. this.requestParam.name = 'copybarmilk'
  940. this.requestParam.parammaps = {}
  941. this.requestParam.parammaps.pastureid = this.selectList[0].pastureid
  942. this.requestParam.parammaps.id = this.selectList[0].id
  943. PostDataByName(this.requestParam).then(response => {
  944. if (response.msg === 'fail') {
  945. const barid = new RegExp("key 'barid'")
  946. if (barid.test(response.data)) {
  947. this.$message({ type: 'error', message: '该栏舍今日生产性能已存在,不可重复生成', duration: 2000 })
  948. } else {
  949. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  950. }
  951. } else {
  952. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  953. this.getList()
  954. }
  955. })
  956. }).catch(() => {
  957. this.$message({ type: 'info', message: '已取消删除' })
  958. })
  959. } else {
  960. this.$message({ type: 'error', message: '请选择一条栏舍生产性能', duration: 2000 })
  961. }
  962. },
  963. // 导出
  964. handleExport(item) {
  965. if (item == 1) {
  966. console.log('点击了导出模板')
  967. } else {
  968. console.log('点击了导出数据')
  969. }
  970. },
  971. // 导入
  972. handleImport() {
  973. console.log('点击了导入')
  974. }
  975. }
  976. }
  977. </script>
  978. <style lang="scss" scoped>
  979. .search{padding-top:10px;clear: both;}
  980. .table{margin-top:10px;}
  981. </style>