|
@@ -0,0 +1,300 @@
|
|
|
|
+<template>
|
|
|
|
+ <t-table
|
|
|
|
+ size="small"
|
|
|
|
+ row-key="id"
|
|
|
|
+ :columns="columns"
|
|
|
|
+ :data="tableData"
|
|
|
|
+ bordered
|
|
|
|
+ class="mt-10px"
|
|
|
|
+ >
|
|
|
|
+ <template #ddd="{ row }">
|
|
|
|
+ {{ RUNNING_STATUS[row.ddd] }}
|
|
|
|
+ </template>
|
|
|
|
+ <template #fff="{ row }">
|
|
|
|
+ {{ DEVICE_USE_STATUS[row.fff] }}
|
|
|
|
+ </template>
|
|
|
|
+ <template #operate="{ row }">
|
|
|
|
+ <div class="table-operations" @click.stop>
|
|
|
|
+ <t-link theme="primary" hover="color" @click="enter(row)">入库</t-link>
|
|
|
|
+ <t-link theme="primary" hover="color" @click="middle(row)">中转</t-link>
|
|
|
|
+ <t-link theme="primary" hover="color" @click="edit(row)">编辑</t-link>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </t-table>
|
|
|
|
+ <my-dialog
|
|
|
|
+ :visible="showEnterDialog"
|
|
|
|
+ :header="`入库`"
|
|
|
|
+ :width="400"
|
|
|
|
+ :closeOnOverlayClick="false"
|
|
|
|
+ attach="body"
|
|
|
|
+ @close="showEnterDialog = false"
|
|
|
|
+ @confirm="enterConfirm"
|
|
|
|
+ >
|
|
|
|
+ <SearchForm
|
|
|
|
+ :params="enterParams"
|
|
|
|
+ :fields="enterFields"
|
|
|
|
+ :rules="enterRules"
|
|
|
|
+ noBorder
|
|
|
|
+ ref="enterForm"
|
|
|
|
+ ></SearchForm>
|
|
|
|
+ </my-dialog>
|
|
|
|
+
|
|
|
|
+ <my-dialog
|
|
|
|
+ :visible="showMiddleDialog"
|
|
|
|
+ :header="`中转`"
|
|
|
|
+ :width="400"
|
|
|
|
+ :closeOnOverlayClick="false"
|
|
|
|
+ attach="body"
|
|
|
|
+ @close="showMiddleDialog = false"
|
|
|
|
+ @confirm="middleConfirm"
|
|
|
|
+ >
|
|
|
|
+ <SearchForm
|
|
|
|
+ :params="middleParams"
|
|
|
|
+ :fields="middleFields"
|
|
|
|
+ :rules="middleRules"
|
|
|
|
+ noBorder
|
|
|
|
+ ref="middleForm"
|
|
|
|
+ ></SearchForm>
|
|
|
|
+ </my-dialog>
|
|
|
|
+
|
|
|
|
+ <my-dialog
|
|
|
|
+ :visible="showEditDialog"
|
|
|
|
+ :header="`编辑`"
|
|
|
|
+ :width="400"
|
|
|
|
+ :closeOnOverlayClick="false"
|
|
|
|
+ attach="body"
|
|
|
|
+ @close="showEditDialog = false"
|
|
|
|
+ @confirm="editConfirm"
|
|
|
|
+ >
|
|
|
|
+ <SearchForm
|
|
|
|
+ :params="editParams"
|
|
|
|
+ :fields="editFields"
|
|
|
|
+ :rules="editRules"
|
|
|
|
+ noBorder
|
|
|
|
+ ref="editForm"
|
|
|
|
+ ></SearchForm>
|
|
|
|
+ </my-dialog>
|
|
|
|
+</template>
|
|
|
|
+<script name="DeviceManageNewTab2" setup>
|
|
|
|
+import { ref, computed } from 'vue';
|
|
|
|
+import { RUNNING_STATUS, DEVICE_USE_STATUS } from '@/config/constants';
|
|
|
|
+import { dictToOptionList } from '@/utils/tool';
|
|
|
|
+import { cloneDeep } from 'lodash';
|
|
|
|
+
|
|
|
|
+const curRow = ref(null);
|
|
|
|
+
|
|
|
|
+/**入库弹框 */
|
|
|
|
+const enterForm = ref();
|
|
|
|
+const showEnterDialog = ref(false);
|
|
|
|
+const initEnterParams = { aaa: '', bbb: '', ccc: '' };
|
|
|
|
+const enterParams = ref(cloneDeep(initEnterParams));
|
|
|
|
+const enterFields = ref([
|
|
|
|
+ {
|
|
|
|
+ prop: 'aaa',
|
|
|
|
+ label: '入库方式',
|
|
|
|
+ type: 'select',
|
|
|
|
+ labelWidth: 80,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ options: [
|
|
|
|
+ { value: '邮寄', label: '邮寄' },
|
|
|
|
+ { value: '其它', label: '其它' },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: 'bbb',
|
|
|
|
+ label: '快递单号',
|
|
|
|
+ labelWidth: 80,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: 'ccc',
|
|
|
|
+ label: '备注',
|
|
|
|
+ labelWidth: 80,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ },
|
|
|
|
+]);
|
|
|
|
+const enterRules = ref({
|
|
|
|
+ aaa: [{ required: true, message: '请选择入库方式' }],
|
|
|
|
+ bbb: [{ required: true, message: '请填写快递单号' }],
|
|
|
|
+});
|
|
|
|
+const enter = (row) => {
|
|
|
|
+ curRow.value = row;
|
|
|
|
+ enterParams.value = cloneDeep(initEnterParams);
|
|
|
|
+ showEnterDialog.value = true;
|
|
|
|
+};
|
|
|
|
+const enterConfirm = async () => {
|
|
|
|
+ const formRef = enterForm.value.formRef;
|
|
|
|
+ const valid = await formRef?.validate();
|
|
|
|
+ if (valid !== true) return;
|
|
|
|
+ //todo
|
|
|
|
+
|
|
|
|
+ showEnterDialog.value = false;
|
|
|
|
+};
|
|
|
|
+/***********/
|
|
|
|
+
|
|
|
|
+/**中转弹框 */
|
|
|
|
+const middleForm = ref();
|
|
|
|
+const showMiddleDialog = ref(false);
|
|
|
|
+const initMiddleParams = { aaa: '', bbb: '', ccc: '', ddd: '' };
|
|
|
|
+const middleParams = ref(cloneDeep(initMiddleParams));
|
|
|
|
+const middleFields = ref([
|
|
|
|
+ {
|
|
|
|
+ prop: 'aaa',
|
|
|
|
+ label: '中转方式',
|
|
|
|
+ type: 'select',
|
|
|
|
+ labelWidth: 80,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ options: [
|
|
|
|
+ { value: '邮寄', label: '邮寄' },
|
|
|
|
+ { value: '其它', label: '其它' },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: 'bbb',
|
|
|
|
+ label: '快递单号',
|
|
|
|
+ labelWidth: 80,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: 'ccc',
|
|
|
|
+ label: '备注',
|
|
|
|
+ labelWidth: 80,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: 'ddd',
|
|
|
|
+ label: '接收方单号',
|
|
|
|
+ labelWidth: 80,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ },
|
|
|
|
+]);
|
|
|
|
+const middleRules = ref({
|
|
|
|
+ aaa: [{ required: true, message: '请选择中转方式' }],
|
|
|
|
+ bbb: [{ required: true, message: '请填写快递单号' }],
|
|
|
|
+ ddd: [{ required: true, message: '请填写接收方单号' }],
|
|
|
|
+});
|
|
|
|
+const middle = (row) => {
|
|
|
|
+ curRow.value = row;
|
|
|
|
+ middleParams.value = cloneDeep(initMiddleParams);
|
|
|
|
+ showMiddleDialog.value = true;
|
|
|
|
+};
|
|
|
|
+const middleConfirm = async () => {
|
|
|
|
+ const formRef = middleForm.value.formRef;
|
|
|
|
+ const valid = await formRef?.validate();
|
|
|
|
+ if (valid !== true) return;
|
|
|
|
+ //todo
|
|
|
|
+
|
|
|
|
+ showMiddleDialog.value = false;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/***********/
|
|
|
|
+
|
|
|
|
+/**编辑弹框 */
|
|
|
|
+const editForm = ref();
|
|
|
|
+const showEditDialog = ref(false);
|
|
|
|
+const initEditParams = { aaa: '', bbb: '', ccc: '', ddd: '', eee: '' };
|
|
|
|
+const editParams = ref(cloneDeep(initEditParams));
|
|
|
|
+const editFields = computed(() => {
|
|
|
|
+ return [
|
|
|
|
+ {
|
|
|
|
+ prop: 'aaa',
|
|
|
|
+ label: '使用状态',
|
|
|
|
+ type: 'select',
|
|
|
|
+ labelWidth: 90,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ options: [
|
|
|
|
+ { value: '中转', label: '中转' },
|
|
|
|
+ { value: '入库', label: '入库' },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ prop: 'bbb',
|
|
|
|
+ label: '中转方式',
|
|
|
|
+ type: 'select',
|
|
|
|
+ labelWidth: 90,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ options: [
|
|
|
|
+ { value: '邮寄', label: '邮寄' },
|
|
|
|
+ { value: '其它', label: '其它' },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ editParams.value.bbb === '邮寄'
|
|
|
|
+ ? {
|
|
|
|
+ prop: 'ccc',
|
|
|
|
+ label: '快递单号',
|
|
|
|
+ labelWidth: 90,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ }
|
|
|
|
+ : null,
|
|
|
|
+ editParams.value.aaa === '中转'
|
|
|
|
+ ? {
|
|
|
|
+ prop: 'ddd',
|
|
|
|
+ label: '接收方单号',
|
|
|
|
+ labelWidth: 90,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ }
|
|
|
|
+ : null,
|
|
|
|
+ editParams.value.bbb === '其它'
|
|
|
|
+ ? {
|
|
|
|
+ prop: 'eee',
|
|
|
|
+ label: '备注',
|
|
|
|
+ labelWidth: 90,
|
|
|
|
+ colSpan: 24,
|
|
|
|
+ }
|
|
|
|
+ : null,
|
|
|
|
+ ];
|
|
|
|
+});
|
|
|
|
+const editRules = ref({
|
|
|
|
+ aaa: [{ required: true, message: '请选择使用状态' }],
|
|
|
|
+ bbb: [{ required: true, message: '请选择中转方式' }],
|
|
|
|
+ ccc: [{ required: true, message: '请填写快递单号' }],
|
|
|
|
+ ddd: [{ required: true, message: '请填写接收方单号' }],
|
|
|
|
+});
|
|
|
|
+const edit = (row) => {
|
|
|
|
+ curRow.value = row;
|
|
|
|
+ editParams.value = cloneDeep(initEditParams);
|
|
|
|
+ showEditDialog.value = true;
|
|
|
|
+};
|
|
|
|
+const editConfirm = async () => {
|
|
|
|
+ const formRef = editForm.value.formRef;
|
|
|
|
+ const valid = await formRef?.validate();
|
|
|
|
+ if (valid !== true) return;
|
|
|
|
+ //todo
|
|
|
|
+
|
|
|
|
+ showEditDialog.value = false;
|
|
|
|
+};
|
|
|
|
+/***********/
|
|
|
|
+
|
|
|
|
+const columns = [
|
|
|
|
+ {
|
|
|
|
+ colKey: 'serial-number',
|
|
|
|
+ title: '序号',
|
|
|
|
+ width: 48,
|
|
|
|
+ },
|
|
|
|
+ { colKey: 'aaa', title: '设备序列号' },
|
|
|
|
+ { colKey: 'bbb', title: '设备型号' },
|
|
|
|
+ { colKey: 'ccc', title: '状态', cell: 'ccc' },
|
|
|
|
+ { colKey: 'ddd', title: '设备归属' },
|
|
|
|
+ { colKey: 'eee', title: '运输方式' },
|
|
|
|
+ { colKey: 'fff', title: '使用状态', cell: 'fff' },
|
|
|
|
+ { colKey: 'ggg', title: '接收方单号' },
|
|
|
|
+ {
|
|
|
|
+ title: '管理',
|
|
|
|
+ colKey: 'operate',
|
|
|
|
+ fixed: 'right',
|
|
|
|
+ width: 180,
|
|
|
|
+ },
|
|
|
|
+];
|
|
|
|
+const tableData = ref([
|
|
|
|
+ {
|
|
|
|
+ aaa: 'aaa',
|
|
|
|
+ bbb: 'bbb',
|
|
|
|
+ ccc: 'ccc',
|
|
|
|
+ ddd: 'BREAK_DOWN',
|
|
|
|
+ eee: 'eee',
|
|
|
|
+ fff: '1',
|
|
|
|
+ ggg: 'ggg',
|
|
|
|
+ },
|
|
|
|
+]);
|
|
|
|
+</script>
|
|
|
|
+<style lang="less" scoped></style>
|