123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- <template>
- <xn-form-container
- :title="formData.id ? '起卸调度详情' : '起卸调度详情'"
- :width="900"
- v-model:open="open"
- :destroy-on-close="true"
- @close="onClose"
- >
- <!-- <a-form ref="formRef" :model="formData" :rules="formRules" :wrapper-col="wrapperCol" :label-col="labelCol">
- <a-form-item label="预约单号:" name="loadNumber">
- <a-input v-model:value="formData.loadNumber" placeholder="请输入预约单号" allow-clear disabled/>
- </a-form-item>
- <a-form-item label="起卸点位:" name="loadPointId">
- <a-select v-model:value="formData.loadPointId" placeholder="请选择装卸点位"
- :options="loadPointIdList" @change="onChangePoint"
- > </a-select>
- </a-form-item>
- <a-form-item label="起卸时间:" name="loadTimeId" >
- <a-select v-model:value="formData.loadTimeId" placeholder="请选择装卸时间"
- :options="loadTimeIdList" @change="onChangeLoadTime"
- > </a-select>
- </a-form-item>
- <a-form-item label="执行人员:" name="userId">
- <xn-user-selector
- :org-tree-api="selectorApiFunction.orgTreeApi"
- :user-page-api="selectorApiFunction.userPageApi"
- :radio-model="true"
- placeholder="请选择执行人员"
- v-model:value="formData.userId"
- />
- </a-form-item>
- </a-form>-->
- <s-table
- ref="tableRef"
- :columns="columns"
- :data="loadData"
- bordered
- :row-key="(record) => record.id"
- >
- <template #operator class="table-operator">
- <a-space>
- <a-button type="primary" @click="dispatchLoadAddRef.onOpen(appointId)">
- <template #icon><plus-outlined /></template>
- 新增
- </a-button>
- </a-space>
- </template>
- <template #bodyCell="{ column, record }">
- <template v-if="column.dataIndex === 'action'">
- <a-space>
- <a-button type="link" size="small" v-if="hasPerm('bizLoadReplace')" @click="replaceRef.onOpen(record)">更换</a-button>
- </a-space>
- <a-space>
- <a-button type="link" danger size="small" v-if="hasPerm('bizOrderDispatchDelete')" @click="deleteConfig(record)">删除</a-button>
- </a-space>
- </template>
- </template>
- </s-table>
- <!-- <template #footer>
- <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
- <a-button type="primary" @click="onSubmit" :loading="submitLoading">保存</a-button>
- </template>-->
- <Replace ref="replaceRef" @successful="tableRef.refresh(true)" />
- <DispatchLoadAdd ref="dispatchLoadAddRef" @successful="tableRef.refresh(true)" />
- </xn-form-container>
- </template>
- <script setup name="bizOrderForm">
- import { cloneDeep } from 'lodash-es'
- import { required } from '@/utils/formRules'
- import tool from '@/utils/tool'
- import goodsConfApi from '@/api/biz/goodsConfApi'
- import bizSaleOrderApi from "@/api/biz/bizSaleOrderApi";
- import bizLoadPointApi from "@/api/biz/bizLoadPointApi";
- import bizLoadTimeApi from "@/api/biz/bizLoadTimeApi"
- import bizOrderLoadApi from "@/api/biz/bizOrderLoadApi";
- import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
- import {Modal} from 'ant-design-vue';
- import {createVNode} from 'vue';
- import Replace from './replaceload.vue'
- import bizLoadDispatchApi from "@/api/biz/bizLoadDispatchApi";
- import userApi from '@/api/biz/bizUserApi'
- import DispatchLoadAdd from './dispatchloadadd.vue'
- // 抽屉状态
- const open = ref(false)
- const emit = defineEmits({ successful: null })
- const formRef = ref()
- const tableRef = ref()
- const replaceRef = ref()
- const dispatchLoadAddRef = ref()
- const numberFlag = ref(false)
- // 表单数据
- const formData = ref({})
- const submitLoading = ref(false)
- //设置表单样式
- const labelCol = ref({ span: 5})
- const wrapperCol = ref({ span: 16})
- //订单类型
- const orderTypeList = tool.dictList('order_type')
- const goodIdList = ref()
- const customerIdList = ref()
- const saleOrderInfoList = ref()
- const deliveryTimeIdList = ref()
- const supplierIdList = ref()
- const loadPointIdList = ref()
- const loadTimeIdList = ref()
- const appointId = ref()
- // 打开抽屉
- const onOpen = (record) => {
- open.value = true
- if (record) {
- let recordData = cloneDeep(record)
- formData.value = Object.assign({}, recordData)
- appointId.value = formData.value.id
- }
- //装货点位查询
- bizLoadPointApi.getList({appointType:'1'}).then((res)=>{
- loadPointIdList.value = res.map((item)=>{
- return{
- value:item.id,
- label:item.loadPoint
- }
- })
- })
- }
- // 传递设计器需要的API
- const selectorApiFunction = {
- orgTreeApi: (param) => {
- return userApi.userOrgTreeSelector(param).then((data) => {
- return Promise.resolve(data)
- })
- },
- userPageApi: (param) => {
- param.roleName = '起卸员'
- return userApi.userSelectorByRole(param).then((data) => {
- return Promise.resolve(data)
- })
- }
- }
- //卸货点位点击事件
- const onChangePoint =(value)=>{
- formData.value.loadTimeId = ''
- loadTimeIdList.value = ''
- formData.value.availableNumber = ''
- formData.value.alreadyNumber = ''
- bizLoadTimeApi.searchNow({pointId:formData.value.loadPointId}).then((res)=>{
- loadTimeIdList.value = res.map((item)=>{
- return{
- value:item.id,
- label:item.beginTime+'~'+item.endTime
- }
- })
- })
- }
- const onChangeLoadTime = (value) => {
- bizLoadTimeApi.bizLoadTimeDetail({id:value}).then((res)=>{
- formData.value.availableNumber = res.availableNumber
- formData.value.alreadyNumber = res.alreadyNumber
- //numberFlag.value = true
- })
- }
- const loadData = (parameter) => {
- return bizLoadDispatchApi.getPageList({appointId:formData.value.id,appointType:'1'}).then((data) => {
- return data
- })
- }
- const columns = [
- {
- title: '起卸点位',
- dataIndex: 'loadPoint',
- align:'center'
- },
- {
- title: '执行人员',
- dataIndex: 'userName',
- align:'center'
- },
- {
- title: '开始时间',
- dataIndex: 'beginTime',
- align:'center'
- },
- {
- title: '结束时间',
- dataIndex: 'endTime',
- align:'center'
- },
- /*{
- title: '可约次数',
- dataIndex: 'availableNumber',
- align:'center'
- },
- {
- title: '已约次数',
- dataIndex: 'alreadyNumber',
- align:'center'
- },*/
- ]
- // 操作栏通过权限判断是否显示
- columns.push({
- title: '操作',
- dataIndex: 'action',
- align: 'center',
- width: 150
- })
- // 关闭抽屉
- const onClose = () => {
- formRef.value.resetFields()
- formData.value = {}
- open.value = false
- loadTimeIdList.value = ''
- numberFlag.value = false
- emit('successful')
- }
- // 默认要校验的
- const formRules = {
- //orderNumber: [required('请输入订单编号')],
- //orderName: [required('请输入订单名称')],
- //customerId:[required('请选择客户信息')],
- loadPointId:[required('请选择装卸点位')],
- loadTimeId: [required('请选择装卸时间')],
- userId: [required('请选择执行人员')],
- }
- // 删除
- const deleteConfig = (record) => {
- Modal.confirm({
- title: '确定删除该数据吗?',
- icon: createVNode(ExclamationCircleOutlined),
- content: '',
- onOk() {
- submitLoading.value = true
- let params = [
- {
- id: record.id
- }
- ]
- bizLoadDispatchApi
- .bizLoadDispatchDelete(params)
- .then(() => {
- tableRef.value.refresh(true)
- })
- .finally(() => {
- submitLoading.value = false
- })
- },
- onCancel() {}
- })
- }
- // 验证并提交数据
- const onSubmit = () => {
- formRef.value
- .validate()
- .then(() => {
- submitLoading.value = true
- const formDataParam = cloneDeep(formData.value)
- formDataParam.appointId = formDataParam.id
- formDataParam.id = ''
- bizLoadDispatchApi
- .bizLoadDispatchSubmitLoad(formDataParam, formDataParam.id)
- .then(() => {
- onClose()
- })
- .finally(() => {
- submitLoading.value = false
- })
- })
- .catch(() => {})
- }
- // 抛出函数
- defineExpose({
- onOpen
- })
- </script>
- <style>
- /* 修改禁用状态下的颜色 */
- .ant-radio-button-wrapper-disabled {
- color: black !important; /* 设置文字颜色 */
- background-color: #f0f0f0 !important; /* 设置背景颜色 */
- }
- /* 修改禁用状态下选中项的颜色 */
- .ant-radio-button-wrapper-checked.ant-radio-button-wrapper-disabled {
- color: white !important; /* 设置文字颜色 */
- background-color: blue !important; /* 设置选中项的背景颜色 */
- }
- </style>
|