dispatchload.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <xn-form-container
  3. :title="formData.id ? '起卸调度详情' : '起卸调度详情'"
  4. :width="900"
  5. v-model:open="open"
  6. :destroy-on-close="true"
  7. @close="onClose"
  8. >
  9. <!-- <a-form ref="formRef" :model="formData" :rules="formRules" :wrapper-col="wrapperCol" :label-col="labelCol">
  10. <a-form-item label="预约单号:" name="loadNumber">
  11. <a-input v-model:value="formData.loadNumber" placeholder="请输入预约单号" allow-clear disabled/>
  12. </a-form-item>
  13. <a-form-item label="起卸点位:" name="loadPointId">
  14. <a-select v-model:value="formData.loadPointId" placeholder="请选择装卸点位"
  15. :options="loadPointIdList" @change="onChangePoint"
  16. > </a-select>
  17. </a-form-item>
  18. <a-form-item label="起卸时间:" name="loadTimeId" >
  19. <a-select v-model:value="formData.loadTimeId" placeholder="请选择装卸时间"
  20. :options="loadTimeIdList" @change="onChangeLoadTime"
  21. > </a-select>
  22. </a-form-item>
  23. <a-form-item label="执行人员:" name="userId">
  24. <xn-user-selector
  25. :org-tree-api="selectorApiFunction.orgTreeApi"
  26. :user-page-api="selectorApiFunction.userPageApi"
  27. :radio-model="true"
  28. placeholder="请选择执行人员"
  29. v-model:value="formData.userId"
  30. />
  31. </a-form-item>
  32. </a-form>-->
  33. <s-table
  34. ref="tableRef"
  35. :columns="columns"
  36. :data="loadData"
  37. bordered
  38. :row-key="(record) => record.id"
  39. >
  40. <template #operator class="table-operator">
  41. <a-space>
  42. <a-button type="primary" @click="dispatchLoadAddRef.onOpen(appointId)">
  43. <template #icon><plus-outlined /></template>
  44. 新增
  45. </a-button>
  46. </a-space>
  47. </template>
  48. <template #bodyCell="{ column, record }">
  49. <template v-if="column.dataIndex === 'action'">
  50. <a-space>
  51. <a-button type="link" size="small" v-if="hasPerm('bizLoadReplace')" @click="replaceRef.onOpen(record)">更换</a-button>
  52. </a-space>
  53. <a-space>
  54. <a-button type="link" danger size="small" v-if="hasPerm('bizOrderDispatchDelete')" @click="deleteConfig(record)">删除</a-button>
  55. </a-space>
  56. </template>
  57. </template>
  58. </s-table>
  59. <!-- <template #footer>
  60. <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
  61. <a-button type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
  62. </template>-->
  63. <Replace ref="replaceRef" @successful="tableRef.refresh(true)" />
  64. <DispatchLoadAdd ref="dispatchLoadAddRef" @successful="tableRef.refresh(true)" />
  65. </xn-form-container>
  66. </template>
  67. <script setup name="bizOrderForm">
  68. import { cloneDeep } from 'lodash-es'
  69. import { required } from '@/utils/formRules'
  70. import tool from '@/utils/tool'
  71. import goodsConfApi from '@/api/biz/goodsConfApi'
  72. import bizSaleOrderApi from "@/api/biz/bizSaleOrderApi";
  73. import bizLoadPointApi from "@/api/biz/bizLoadPointApi";
  74. import bizLoadTimeApi from "@/api/biz/bizLoadTimeApi"
  75. import bizOrderLoadApi from "@/api/biz/bizOrderLoadApi";
  76. import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
  77. import {Modal} from 'ant-design-vue';
  78. import {createVNode} from 'vue';
  79. import Replace from './replaceload.vue'
  80. import bizLoadDispatchApi from "@/api/biz/bizLoadDispatchApi";
  81. import userApi from '@/api/biz/bizUserApi'
  82. import DispatchLoadAdd from './dispatchloadadd.vue'
  83. // 抽屉状态
  84. const open = ref(false)
  85. const emit = defineEmits({ successful: null })
  86. const formRef = ref()
  87. const tableRef = ref()
  88. const replaceRef = ref()
  89. const dispatchLoadAddRef = ref()
  90. const numberFlag = ref(false)
  91. // 表单数据
  92. const formData = ref({})
  93. const submitLoading = ref(false)
  94. //设置表单样式
  95. const labelCol = ref({ span: 5})
  96. const wrapperCol = ref({ span: 16})
  97. //订单类型
  98. const orderTypeList = tool.dictList('order_type')
  99. const goodIdList = ref()
  100. const customerIdList = ref()
  101. const saleOrderInfoList = ref()
  102. const deliveryTimeIdList = ref()
  103. const supplierIdList = ref()
  104. const loadPointIdList = ref()
  105. const loadTimeIdList = ref()
  106. const appointId = ref()
  107. // 打开抽屉
  108. const onOpen = (record) => {
  109. open.value = true
  110. if (record) {
  111. let recordData = cloneDeep(record)
  112. formData.value = Object.assign({}, recordData)
  113. appointId.value = formData.value.id
  114. }
  115. //装货点位查询
  116. bizLoadPointApi.getList({appointType:'1'}).then((res)=>{
  117. loadPointIdList.value = res.map((item)=>{
  118. return{
  119. value:item.id,
  120. label:item.loadPoint
  121. }
  122. })
  123. })
  124. }
  125. // 传递设计器需要的API
  126. const selectorApiFunction = {
  127. orgTreeApi: (param) => {
  128. return userApi.userOrgTreeSelector(param).then((data) => {
  129. return Promise.resolve(data)
  130. })
  131. },
  132. userPageApi: (param) => {
  133. param.roleName = '起卸员'
  134. return userApi.userSelectorByRole(param).then((data) => {
  135. return Promise.resolve(data)
  136. })
  137. }
  138. }
  139. //卸货点位点击事件
  140. const onChangePoint =(value)=>{
  141. formData.value.loadTimeId = ''
  142. loadTimeIdList.value = ''
  143. formData.value.availableNumber = ''
  144. formData.value.alreadyNumber = ''
  145. bizLoadTimeApi.searchNow({pointId:formData.value.loadPointId}).then((res)=>{
  146. loadTimeIdList.value = res.map((item)=>{
  147. return{
  148. value:item.id,
  149. label:item.beginTime+'~'+item.endTime
  150. }
  151. })
  152. })
  153. }
  154. const onChangeLoadTime = (value) => {
  155. bizLoadTimeApi.bizLoadTimeDetail({id:value}).then((res)=>{
  156. formData.value.availableNumber = res.availableNumber
  157. formData.value.alreadyNumber = res.alreadyNumber
  158. //numberFlag.value = true
  159. })
  160. }
  161. const loadData = (parameter) => {
  162. return bizLoadDispatchApi.getPageList({appointId:formData.value.id,appointType:'1'}).then((data) => {
  163. return data
  164. })
  165. }
  166. const columns = [
  167. {
  168. title: '起卸点位',
  169. dataIndex: 'loadPoint',
  170. align:'center'
  171. },
  172. {
  173. title: '执行人员',
  174. dataIndex: 'userName',
  175. align:'center'
  176. },
  177. {
  178. title: '开始时间',
  179. dataIndex: 'beginTime',
  180. align:'center'
  181. },
  182. {
  183. title: '结束时间',
  184. dataIndex: 'endTime',
  185. align:'center'
  186. },
  187. /*{
  188. title: '可约次数',
  189. dataIndex: 'availableNumber',
  190. align:'center'
  191. },
  192. {
  193. title: '已约次数',
  194. dataIndex: 'alreadyNumber',
  195. align:'center'
  196. },*/
  197. ]
  198. // 操作栏通过权限判断是否显示
  199. columns.push({
  200. title: '操作',
  201. dataIndex: 'action',
  202. align: 'center',
  203. width: 150
  204. })
  205. // 关闭抽屉
  206. const onClose = () => {
  207. formRef.value.resetFields()
  208. formData.value = {}
  209. open.value = false
  210. loadTimeIdList.value = ''
  211. numberFlag.value = false
  212. emit('successful')
  213. }
  214. // 默认要校验的
  215. const formRules = {
  216. //orderNumber: [required('请输入订单编号')],
  217. //orderName: [required('请输入订单名称')],
  218. //customerId:[required('请选择客户信息')],
  219. loadPointId:[required('请选择装卸点位')],
  220. loadTimeId: [required('请选择装卸时间')],
  221. userId: [required('请选择执行人员')],
  222. }
  223. // 删除
  224. const deleteConfig = (record) => {
  225. Modal.confirm({
  226. title: '确定删除该数据吗?',
  227. icon: createVNode(ExclamationCircleOutlined),
  228. content: '',
  229. onOk() {
  230. submitLoading.value = true
  231. let params = [
  232. {
  233. id: record.id
  234. }
  235. ]
  236. bizLoadDispatchApi
  237. .bizLoadDispatchDelete(params)
  238. .then(() => {
  239. tableRef.value.refresh(true)
  240. })
  241. .finally(() => {
  242. submitLoading.value = false
  243. })
  244. },
  245. onCancel() {}
  246. })
  247. }
  248. // 验证并提交数据
  249. const onSubmit = () => {
  250. formRef.value
  251. .validate()
  252. .then(() => {
  253. submitLoading.value = true
  254. const formDataParam = cloneDeep(formData.value)
  255. formDataParam.appointId = formDataParam.id
  256. formDataParam.id = ''
  257. bizLoadDispatchApi
  258. .bizLoadDispatchSubmitLoad(formDataParam, formDataParam.id)
  259. .then(() => {
  260. onClose()
  261. })
  262. .finally(() => {
  263. submitLoading.value = false
  264. })
  265. })
  266. .catch(() => {})
  267. }
  268. // 抛出函数
  269. defineExpose({
  270. onOpen
  271. })
  272. </script>
  273. <style>
  274. /* 修改禁用状态下的颜色 */
  275. .ant-radio-button-wrapper-disabled {
  276. color: black !important; /* 设置文字颜色 */
  277. background-color: #f0f0f0 !important; /* 设置背景颜色 */
  278. }
  279. /* 修改禁用状态下选中项的颜色 */
  280. .ant-radio-button-wrapper-checked.ant-radio-button-wrapper-disabled {
  281. color: white !important; /* 设置文字颜色 */
  282. background-color: blue !important; /* 设置选中项的背景颜色 */
  283. }
  284. </style>