a470f50f278733e3724c06916b246f54392290e1.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button class="success" @click="handleCreate">新增</el-button>
  5. </div>
  6. <div class="search">
  7. <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  8. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="操作类型" class="filter-item" style="width: 120px;" clearable>
  9. <el-option v-for="item in operationTypeList" :key="item.id" :label="item.name" :value="item.name" />
  10. </el-select>
  11. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="饲料名称" class="filter-item" style="width: 150px;" clearable>
  12. <el-option v-for="item in feedNameList" :key="item.id" :label="item.name" :value="item.name" />
  13. </el-select>
  14. <tree-select
  15. class="typeSelect"
  16. :height="150"
  17. :width="150"
  18. size="small"
  19. clearable
  20. :data="type.parentDept"
  21. :disabled="type.disabled"
  22. :placeholder="type.placeholder"
  23. style="display:inline-block;"
  24. :default-props="type.defaultProps"
  25. :node-key="type.nodeKey"
  26. :checked-keys="type.defaultCheckedKeys"
  27. @popoverHide="popoverHide"
  28. />
  29. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  30. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  31. </div>
  32. <div class="table">
  33. <el-table
  34. :key="table.tableKey"
  35. v-loading="table.listLoading"
  36. element-loading-text="给我一点时间"
  37. :data="table.list"
  38. border
  39. fit
  40. highlight-current-row
  41. style="width: 100%;"
  42. :row-style="rowStyle"
  43. :cell-style="cellStyle"
  44. class="elTable table-fixed"
  45. >
  46. <el-table-column label="序号" align="center" type="index" width="50px">
  47. <template slot-scope="scope">
  48. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="出库日期" min-width="130px" align="center">
  52. <template slot-scope="scope">
  53. <span>{{ scope.row.brandName }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="牲畜类别" min-width="130px" align="center">
  57. <template slot-scope="scope">
  58. <span>{{ scope.row.brandName }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="饲料名称" min-width="110px" align="center">
  62. <template slot-scope="scope">
  63. <span>{{ scope.row.brandName }}</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="操作重量(kg)" min-width="110px" align="center">
  67. <template slot-scope="scope">
  68. <span>{{ scope.row.brandName }}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="操作类型" min-width="110px" align="center">
  72. <template slot-scope="scope">
  73. <span>{{ scope.row.brandName }}</span>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="备注" min-width="110px" align="center">
  77. <template slot-scope="scope">
  78. <span>{{ scope.row.brandName }}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="操作人" min-width="110px" align="center">
  82. <template slot-scope="scope">
  83. <span>{{ scope.row.brandName }}</span>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  88. </div>
  89. <!-- 新增/编辑 -->
  90. <el-dialog :title="textMap[create.dialogStatus]" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="80%">
  91. <div class="app-add">
  92. <el-form ref="createTemp" :rules="create.rules" :model="create.createTemp" label-position="right" label-width="130px" style="width: 90%;height:300px;margin:0 auto 50px">
  93. <el-row>
  94. <el-col :span="8">
  95. <el-form-item label="操作类型:" prop="location">
  96. <el-select v-model="create.createTemp.location" placeholder="操作类型" class="filter-item" style="width: 100%;">
  97. <el-option v-for="item in operationTypeList" :key="item.id" :label="item.name" :value="item.name" />
  98. </el-select>
  99. </el-form-item>
  100. </el-col>
  101. <el-col :span="8">
  102. <el-form-item label="出库日期:" prop="location">
  103. <el-date-picker v-model="create.createTemp.location" class="filter-item" type="datetime" placeholder="出库日期" />
  104. </el-form-item>
  105. </el-col>
  106. <el-col :span="8">
  107. <el-form-item label="饲料名称:" prop="location">
  108. <el-select v-model="create.createTemp.location" placeholder="饲料名称" class="filter-item" style="width: 100%;">
  109. <el-option v-for="item in feedNameList" :key="item.id" :label="item.name" :value="item.name" />
  110. </el-select>
  111. </el-form-item>
  112. </el-col>
  113. </el-row>
  114. <el-row>
  115. <el-col :span="8">
  116. <el-form-item label="畜牲类别:" prop="location">
  117. <tree-select
  118. class="filter-item typeSelect"
  119. :height="150"
  120. :width="150"
  121. size="small"
  122. clearable
  123. :data="type.parentDept"
  124. :disabled="type.disabled"
  125. :placeholder="type.placeholder"
  126. style="display:inline-block;"
  127. :default-props="type.defaultProps"
  128. :node-key="type.nodeKey"
  129. :checked-keys="type.defaultCheckedKeys"
  130. @popoverHide="popoverHide"
  131. />
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="8">
  135. <el-form-item label="操作重量(kg):" prop="location">
  136. <el-input ref="location" v-model="create.createTemp.location" class="filter-item" placeholder="操作重量" type="text" />
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="8">
  140. <el-form-item label="备注:" prop="location">
  141. <el-input ref="location" v-model="create.createTemp.location" class="filter-item" placeholder="备注" type="text" />
  142. </el-form-item>
  143. </el-col>
  144. </el-row>
  145. </el-form>
  146. <div slot="footer" class="dialog-footer">
  147. <el-button class="cancel" @click="create.dialogFormVisible = false; ">关闭</el-button>
  148. <el-button class="success" :disabled="isokDisable" @click="createData()">确认</el-button>
  149. </div>
  150. </div>
  151. </el-dialog>
  152. </div>
  153. </template>
  154. <script>
  155. import { GetDataByName, transData } from '@/api/common'
  156. import Pagination from '@/components/Pagination'
  157. import TreeSelect from '@/components/TreeSelect'
  158. export default {
  159. name: 'LaborConsumption',
  160. components: { Pagination, TreeSelect },
  161. data() {
  162. return {
  163. operationTypeList: [{ id: 0, name: '全部' }, { id: 1, name: '损耗' }, { id: 2, name: '人工用量' }], // 操作类型
  164. feedNameList: [{ id: 0, name: '羊草' }, { id: 1, name: '小苏打' }], // 饲料名称
  165. table: {
  166. getdataListParm: {
  167. name: 'getAssetList',
  168. page: 1,
  169. offset: 1,
  170. pagecount: 10,
  171. returntype: 'Map',
  172. parammaps: {
  173. enable: ''
  174. }
  175. },
  176. tableKey: 0,
  177. list: [],
  178. total: 0,
  179. listLoading: true
  180. },
  181. type: {
  182. getDeptListParm: { name: 'getpart_classList' },
  183. listType: [],
  184. parentDept: [],
  185. disabled: false,
  186. placeholder: '请选择牲畜类别',
  187. defaultProps: {
  188. children: 'children',
  189. label: 'partClassNameCode'
  190. },
  191. nodeKey: 'id',
  192. defaultCheckedKeys: []
  193. },
  194. create: {
  195. dialogFormVisible: false,
  196. dialogStatus: '',
  197. createTemp: {},
  198. rules: {}
  199. },
  200. textMap: {
  201. create: '新增'
  202. },
  203. isokDisable: false,
  204. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  205. cellStyle: { padding: 0 + 'px' }
  206. }
  207. },
  208. created() {
  209. this.getList()
  210. this.getTypeList()
  211. },
  212. methods: {
  213. getTypeList() {
  214. this.type.getDeptListParm.parammaps = this.deptform
  215. GetDataByName(this.type.getDeptListParm).then(response => {
  216. this.type.listType = response.data
  217. if (response.data.list !== null) {
  218. this.type.listType = transData(response.data.list, 'id', 'pid', 'children')
  219. }
  220. this.type.parentDept = this.type.listType
  221. })
  222. },
  223. popoverHide(checkedIds, checkedData) {
  224. console.log(checkedIds, checkedData)
  225. if (checkedIds !== null) {
  226. if (checkedData.childrens == 0) {
  227. console.log(checkedData)
  228. } else {
  229. this.type.defaultCheckedKeys = []
  230. this.$message({ type: 'warning', message: '牲畜类别仅可选择配方模板中父类下的子类' })
  231. }
  232. } else {
  233. this.type.defaultCheckedKeys = []
  234. }
  235. },
  236. getList() {
  237. this.table.listLoading = true
  238. GetDataByName(this.table.getdataListParm).then(response => {
  239. console.log('table数据', response.data.list)
  240. if (response.data.list !== null) {
  241. this.table.list = response.data.list
  242. this.table.pageNum = response.data.pageNum
  243. this.table.pageSize = response.data.pageSize
  244. this.table.total = response.data.total
  245. } else {
  246. this.table.list = []
  247. }
  248. setTimeout(() => {
  249. this.table.listLoading = false
  250. }, 100)
  251. })
  252. },
  253. handleSearch() {
  254. console.log('点击了查询')
  255. this.getList()
  256. },
  257. handleRefresh() {
  258. console.log('点击了重置')
  259. },
  260. resetCreateTemp() {
  261. },
  262. handleCreate() {
  263. console.log('点击了新增')
  264. this.resetCreateTemp()
  265. this.create.dialogStatus = 'create'
  266. this.create.dialogFormVisible = true
  267. },
  268. createData() {
  269. console.log('点击了新增保存')
  270. },
  271. handleRowDelete(row) {
  272. console.log('点击了行内删除')
  273. }
  274. }
  275. }
  276. </script>
  277. <style lang="scss" scoped>
  278. .search{margin-top:10px;}
  279. .table{margin-top:10px;}
  280. </style>
  281. <style lang="scss">
  282. .typeSelect span .el-popover__reference .el-input--suffix {
  283. .el-input__inner{
  284. height:40px !important;
  285. }
  286. }
  287. </style>