assignDialog.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div>
  3. <el-dialog
  4. :title="`指派工单`"
  5. append-to-body
  6. :visible="visibleDialog"
  7. :before-close="closeWindows"
  8. width="80vw"
  9. >
  10. <div class="search_box">
  11. <el-form :model="formData" ref="formRef" label-width="110px">
  12. <el-row :gutter="15">
  13. <el-col :span="8">
  14. <el-form-item label="工单编号" prop="code">
  15. <el-input
  16. disabled
  17. v-model="formData.code"
  18. placeholder="请输入"
  19. ></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="8">
  23. <el-form-item label="关联计划" prop="name">
  24. <el-input
  25. disabled
  26. v-model="formData.name"
  27. placeholder="请输入"
  28. ></el-input>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="8">
  32. <el-form-item label="仓库" prop="warehouseName">
  33. <el-input
  34. disabled
  35. v-model="formData.warehouseName"
  36. placeholder="请输入"
  37. ></el-input>
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="8">
  41. <el-form-item label="执行部门" prop="executeGroupId">
  42. <deptSelect
  43. v-model="formData.executeGroupId"
  44. @changeGroup="searchDeptNodeClick"
  45. />
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="8">
  49. <el-form-item label="执行人员" prop="executorId">
  50. <el-select
  51. v-model="formData.executorId"
  52. @change="executorChange"
  53. size="small"
  54. style="width: 100%"
  55. filterable
  56. >
  57. <el-option
  58. v-for="item in executorList"
  59. :key="item.id"
  60. :value="item.id"
  61. :label="item.name"
  62. ></el-option>
  63. </el-select>
  64. </el-form-item>
  65. </el-col>
  66. </el-row>
  67. </el-form>
  68. </div>
  69. <div class="flex_info">
  70. <div class="flex_right">
  71. <el-table
  72. ref="multipleTable"
  73. :data="tableData"
  74. border
  75. tooltip-effect="dark"
  76. height="455px"
  77. style="width: 100%"
  78. @selection-change="handleSelectionChange"
  79. >
  80. <el-table-column
  81. type="selection"
  82. width="55"
  83. align="center"
  84. fixed="left"
  85. >
  86. </el-table-column>
  87. <el-table-column label="序号" type="index" width="50">
  88. </el-table-column>
  89. <el-table-column
  90. label="物品编码"
  91. prop="info.categoryCode"
  92. :show-overflow-tooltip="true"
  93. ></el-table-column>
  94. <el-table-column
  95. label="物品名称"
  96. prop="info.categoryName"
  97. :show-overflow-tooltip="true"
  98. ></el-table-column>
  99. <el-table-column
  100. width="150"
  101. prop="info.categoryLevelPath"
  102. label="产品分类"
  103. :show-overflow-tooltip="true"
  104. ></el-table-column>
  105. <el-table-column
  106. label="批次号"
  107. prop="info.batchNo"
  108. :show-overflow-tooltip="true"
  109. ></el-table-column>
  110. <el-table-column
  111. label="牌号"
  112. prop="info.brandNum"
  113. :show-overflow-tooltip="true"
  114. ></el-table-column>
  115. <el-table-column
  116. label="型号"
  117. prop="info.categoryModel"
  118. :show-overflow-tooltip="true"
  119. ></el-table-column>
  120. <el-table-column
  121. label="规格"
  122. prop="info.specification"
  123. :show-overflow-tooltip="true"
  124. ></el-table-column>
  125. <el-table-column
  126. label="计量数量"
  127. prop="info.measureQuantity"
  128. :show-overflow-tooltip="true"
  129. ></el-table-column>
  130. <el-table-column
  131. label="计量单位"
  132. prop="info.measureUnit"
  133. :show-overflow-tooltip="true"
  134. ></el-table-column>
  135. <el-table-column
  136. label="重量"
  137. prop="info.weight"
  138. :show-overflow-tooltip="true"
  139. >
  140. </el-table-column>
  141. <el-table-column
  142. label="重量单位"
  143. prop="info.weightUnit"
  144. :show-overflow-tooltip="true"
  145. >
  146. </el-table-column>
  147. </el-table>
  148. </div>
  149. </div>
  150. <div class="select-btn">
  151. <el-button type="primary" @click="onConfirm">确定</el-button>
  152. <el-button @click="closeWindows">关闭</el-button>
  153. </div>
  154. </el-dialog>
  155. </div>
  156. </template>
  157. <script>
  158. import { getInventoryPlanDetailById } from '@/api/inventory';
  159. import deptSelect from '@/components/CommomSelect/new-dept-select.vue';
  160. import { getUserPage } from '@/api/system/organization';
  161. import { sendOrders } from '@/api/inventory';
  162. import { fieldModel } from '@/api/codeManagement';
  163. export default {
  164. props: {
  165. visibleDialog: {
  166. type: Boolean,
  167. default: false
  168. },
  169. planId: {
  170. type: String,
  171. default: ''
  172. }
  173. },
  174. watch: {
  175. tableData() {
  176. this.doLayout();
  177. },
  178. visibleDialog(val) {
  179. if (val) {
  180. this._getInformation();
  181. }
  182. }
  183. },
  184. components: { deptSelect },
  185. data() {
  186. return {
  187. formData: {},
  188. executorList: [],
  189. factoryList: [],
  190. factoryId: '',
  191. value: '',
  192. treeType: '',
  193. treeList: [],
  194. tableData: [],
  195. multipleSelection: [],
  196. pages1: { classificationIdList: [] },
  197. pages: {
  198. pageNum: 1,
  199. size: 15
  200. },
  201. total: 0,
  202. curType: '',
  203. classificationId: '',
  204. memoSelection: [],
  205. newColumns: [] // 动态表头
  206. };
  207. },
  208. created() {
  209. this.getFieldModel();
  210. },
  211. methods: {
  212. executorChange(val) {
  213. this.formData.executorName = this.executorList.filter(
  214. (item) => item.id == val
  215. )[0].name;
  216. },
  217. //选择部门(搜索)
  218. searchDeptNodeClick(info, row) {
  219. this.formData.executorId = '';
  220. if (info) {
  221. const params = { groupId: info };
  222. this.getUserList(params);
  223. this.formData.executeGroupName = row.name;
  224. } else {
  225. this.formData.executeGroupId = null;
  226. }
  227. },
  228. // 获取审核人列表、巡点检人员
  229. async getUserList(params) {
  230. try {
  231. let data = { pageNum: 1, size: -1 };
  232. if (params) {
  233. data = Object.assign(data, params);
  234. }
  235. const res = await getUserPage(data);
  236. this.executorList = res.list;
  237. } catch (error) {}
  238. },
  239. doLayout() {
  240. let that = this;
  241. this.$nextTick(() => {
  242. that.$refs.multipleTable.doLayout();
  243. });
  244. },
  245. // 获取动态表头
  246. getFieldModel() {
  247. fieldModel({ fieldModel: 't_main_category' }).then((res) => {
  248. let newRes = res.map((m) => {
  249. return {
  250. prop: 'extField.' + m.prop,
  251. label: m.label,
  252. align: 'center',
  253. showOverflowTooltip: true
  254. };
  255. });
  256. this.newColumns = [...newRes];
  257. });
  258. },
  259. onConfirm() {
  260. if (this.multipleSelection.length > 0) {
  261. let params = {
  262. executeGroupId: this.formData.executeGroupId,
  263. executeGroupName: this.formData.executeGroupName,
  264. executorId: this.formData.executorId,
  265. executorName: this.formData.executorName,
  266. planDetailId: this.multipleSelection.map((item) => item.id),
  267. planId: this.planId
  268. };
  269. sendOrders(params).then(() => {
  270. this.$message.success('派单成功!');
  271. this.$emit('flushed');
  272. this.closeWindows();
  273. });
  274. } else {
  275. this.$message.error('请选择物品!');
  276. }
  277. },
  278. handleSelectionChange(val) {
  279. this.multipleSelection = val;
  280. },
  281. closeWindows() {
  282. this.multipleSelection = [];
  283. this.$emit('update:visibleDialog', false);
  284. },
  285. async _getInformation() {
  286. getInventoryPlanDetailById(this.planId).then((data) => {
  287. this.formData = data;
  288. if(data.executeGroupId) {
  289. this.getUserList({ groupId: data.executeGroupId });
  290. }
  291. this.tableData = data.planDetailVOS;
  292. });
  293. }
  294. }
  295. };
  296. </script>
  297. <style lang="scss" scoped>
  298. :deep(.el-checkbox__input.is-disabled .el-checkbox__inner) {
  299. background-color: #eee !important;
  300. }
  301. .flex_info {
  302. display: flex;
  303. margin-top: 20px;
  304. margin-bottom: 20px;
  305. .flex_left {
  306. width: 202px;
  307. height: 434px;
  308. padding: 10px;
  309. border: 1px solid #d7d7d7;
  310. overflow-y: auto;
  311. }
  312. .flex_right {
  313. flex: 1;
  314. margin-left: 10px;
  315. overflow: hidden;
  316. }
  317. }
  318. .search_box {
  319. overflow: hidden;
  320. }
  321. .select-btn {
  322. text-align: right;
  323. }
  324. .right {
  325. text-align: right;
  326. }
  327. .mt10 {
  328. margin-top: 10px;
  329. }
  330. </style>