فهرست منبع

Merge branch 'master' of http://36.137.93.232:3000/hf/byte-sailing-new

lxf 2 سال پیش
والد
کامیت
26ba9199db

+ 345 - 337
src/components/byForm/index.vue

@@ -1,371 +1,379 @@
 <template>
-	<div class="by-form">
-		<el-form
-			:model="formData"
-			:label-width="formOption.labelWidth"
-			:inline="formOption.inline || false"
-			:rules="rules"
-			:labelPosition="formOption.labelPosition || 'top'"
-			ref="byForm"
-		>
-			<el-form-item
-				:label="i.label"
-				v-for="i in formConfig"
-				:key="i.model"
-				:prop="i.prop"
-				v-show="i.isShow || i.isShow == undefined"
-				:style="
-					i.type == 'title' ? 'width:100%' :
-						i.itemWidth
-						? 'width:' + i.itemWidth + '%'
-						: formOption.itemWidth
-						? 'width:' + formOption.itemWidth + '%'
-						: '100%'
-				"
-				:class="i.isHide ? 'dn' : ''"
-			>
-				<el-input
-					v-if="i.type == 'input'"
-					v-model="formData[i.prop]"
-					:placeholder="i.placeholder || '请输入'"
-					@input="((e)=>commonsEmit(e,i))"
-					:type="i.itemType ? i.itemType : 'text'"
-					:disabled="i.disabled ? i.disabled : false"
-					:max="i.max"
-					:min="i.min"
-					:maxlength="i.maxlength"
-				/>
-				<el-select
-					v-model="formData[i.prop]"
-					:multiple="i.multiple || false"
-					v-else-if="i.type == 'select'"
-					:placeholder="i.placeholder || '请选择'"
-					@change="((e)=>commonsEmit(e,i))"
-					:disabled="i.disabled ? i.disabled : false"
-					:style="i.style"
-				>
-					<el-option :label="j.title || j.name || j.label" :value="j.id || j.value" v-for="j in i.data" :key="j.id">
-					</el-option>
-				</el-select>
-				<el-tree-select
-					v-model="formData[i.prop]"
-					v-else-if="i.type == 'treeSelect'"
-					:data="i.data"
-					:props="{ value: i.propsTreeValue || 'id', label: i.propsTreeLabel || 'label', children: i.propsTreeChildren || 'children' }"
-					value-key="id"
-					:placeholder="i.placeholder || '请选择'"
-					check-strictly
-				/>
-				<el-date-picker
-					v-model="formData[i.prop]"
-					v-else-if="i.type == 'date'"
-					:type="i.itemType"
-					:placeholder="i.placeholder || '请选择时间'"
-					@change="commonsEmit"
-					:disabled="i.disabled ? i.disabled : false"
-					:format="i.format ? i.format : dateFormatInit(i.itemType)"
-      				:value-format="i.format ? i.format : dateFormatInit(i.itemType)"
-				/>
-				<el-switch
-					:disabled="i.disabled ? i.disabled : false"
-					v-else-if="i.type == 'switch'"
-					v-model="formData[i.prop]"
-				/>
-				<el-checkbox-group
-					v-else-if="i.type == 'checkbox'"
-					v-model="formData[i.prop]"
-					:disabled="i.disabled ? i.disabled : false"
-				>
-					<el-checkbox  v-for="j in i.data" :key="j.id || j.value" ::label="j.id  || j.value" name="type">
-						{{ j.name || j.label }}
-					</el-checkbox>
-					
-				</el-checkbox-group>
-				<el-radio-group
-					v-else-if="i.type == 'radio'"
-					v-model="formData[i.prop]"
-					:disabled="i.disabled ? i.disabled : false"
-					
-				>
-					<el-radio 
-						:border="i.border ? i.border : false"
-						v-for="j in i.data" :key="j.id || j.value" :label="j.id  || j.value" name="type"
-					>
-						{{ j.name || j.label }}
-					</el-radio>
-				</el-radio-group>
-				<el-input-number
-					v-else-if="i.type == 'number'"
-					v-model="formData[i.prop]"
-					:placeholder="i.placeholder || '请输入'"
-					@input="commonsEmit"
-					:disabled="i.disabled ? i.disabled : false"
-					:min="i.min ? i.min : 0"
-					:max="i.max ? i.max : 100"
-					:step="i.step ? i.step : 1">
-				</el-input-number>
-				<el-tree
-					v-else-if="i.type == 'tree'"
-					:data="i.data"
-					:props="i.props"
-					:show-checkbox="i.showCheckbox || true"
-				>
-				</el-tree>
-				<el-cascader
-					v-else-if="i.type == 'cascader'"
-					:options="i.data"
-					:props="i.props"
-					:placeholder="i.placeholder || '请选择'"
-					@change="commonsEmit"
-					:disabled="i.disabled ? i.disabled : false"
-					:style="i.style">
-				</el-cascader>
-				<div class="form-title" v-else-if="i.type == 'title'">
-					{{ i.title }}
-				</div>
-				<slot 
-                    :name="i.slotName" 
-                    v-else-if="i.type == 'slot'">
-                    {{i.slotName}}插槽占位符
-                </slot>
-				<div v-else-if="i.type == 'json'">
-					<byForm
-						:formConfig="i.json"
-						:formOption="formOption"
-						v-model="formData[i.prop]"
-						ref="byform"
-					>
-					</byForm>
-				</div>
-			</el-form-item>
-		</el-form>
-	</div>
+  <div class="by-form">
+    <el-form
+      :model="formData"
+      :label-width="formOption.labelWidth"
+      :inline="formOption.inline || false"
+      :rules="rules"
+      :labelPosition="formOption.labelPosition || 'top'"
+      ref="byForm"
+    >
+      <el-form-item
+        :label="i.label"
+        v-for="i in formConfig"
+        :key="i.model"
+        :prop="i.prop"
+        v-show="i.isShow || i.isShow == undefined"
+        :style="
+          i.type == 'title'
+            ? 'width:100%'
+            : i.itemWidth
+            ? 'width:' + i.itemWidth + '%'
+            : formOption.itemWidth
+            ? 'width:' + formOption.itemWidth + '%'
+            : '100%'
+        "
+        :class="i.isHide ? 'dn' : ''"
+      >
+        <el-input
+          v-if="i.type == 'input'"
+          v-model="formData[i.prop]"
+          :placeholder="i.placeholder || '请输入'"
+          @input="(e) => commonsEmit(e, i)"
+          :type="i.itemType ? i.itemType : 'text'"
+          :disabled="i.disabled ? i.disabled : false"
+          :max="i.max"
+          :min="i.min"
+          :maxlength="i.maxlength"
+        />
+        <el-select
+          v-model="formData[i.prop]"
+          :multiple="i.multiple || false"
+          v-else-if="i.type == 'select'"
+          :placeholder="i.placeholder || '请选择'"
+          @change="(e) => commonsEmit(e, i)"
+          :disabled="i.disabled ? i.disabled : false"
+          :style="i.style"
+        >
+          <el-option
+            :label="j.title || j.name || j.label"
+            :value="j.id || j.value"
+            v-for="j in i.data"
+            :key="j.id"
+          >
+          </el-option>
+        </el-select>
+        <el-tree-select
+          v-model="formData[i.prop]"
+          v-else-if="i.type == 'treeSelect'"
+          :data="i.data"
+          :props="{
+            value: i.propsTreeValue || 'id',
+            label: i.propsTreeLabel || 'label',
+            children: i.propsTreeChildren || 'children',
+          }"
+          value-key="id"
+          :placeholder="i.placeholder || '请选择'"
+          check-strictly
+        />
+        <el-date-picker
+          v-model="formData[i.prop]"
+          v-else-if="i.type == 'date'"
+          :type="i.itemType"
+          :placeholder="i.placeholder || '请选择时间'"
+          @change="commonsEmit"
+          :disabled="i.disabled ? i.disabled : false"
+          :format="i.format ? i.format : dateFormatInit(i.itemType)"
+          :value-format="i.format ? i.format : dateFormatInit(i.itemType)"
+        />
+        <el-switch
+          :disabled="i.disabled ? i.disabled : false"
+          v-else-if="i.type == 'switch'"
+          v-model="formData[i.prop]"
+        />
+        <el-checkbox-group
+          v-else-if="i.type == 'checkbox'"
+          v-model="formData[i.prop]"
+          :disabled="i.disabled ? i.disabled : false"
+        >
+          <el-checkbox
+            v-for="j in i.data"
+            :key="j.id || j.value"
+            ::label="j.id  || j.value"
+            name="type"
+          >
+            {{ j.name || j.label }}
+          </el-checkbox>
+        </el-checkbox-group>
+        <el-radio-group
+          v-else-if="i.type == 'radio'"
+          v-model="formData[i.prop]"
+          :disabled="i.disabled ? i.disabled : false"
+        >
+          <el-radio
+            :border="i.border ? i.border : false"
+            v-for="j in i.data"
+            :key="j.id || j.value"
+            :label="j.id || j.value"
+            name="type"
+          >
+            {{ j.name || j.label }}
+          </el-radio>
+        </el-radio-group>
+        <el-input-number
+          v-else-if="i.type == 'number'"
+          v-model="formData[i.prop]"
+          :placeholder="i.placeholder || '请输入'"
+          @input="commonsEmit"
+          :disabled="i.disabled ? i.disabled : false"
+          :min="i.min ? i.min : 0"
+          :max="i.max ? i.max : 100"
+          :step="i.step ? i.step : 1"
+        >
+        </el-input-number>
+        <el-tree
+          v-else-if="i.type == 'tree'"
+          :data="i.data"
+          :props="i.props"
+          :show-checkbox="i.showCheckbox || true"
+        >
+        </el-tree>
+        <el-cascader
+          v-else-if="i.type == 'cascader'"
+          :options="i.data"
+          :props="i.props"
+          :placeholder="i.placeholder || '请选择'"
+          @change="commonsEmit"
+          :disabled="i.disabled ? i.disabled : false"
+          :style="i.style"
+        >
+        </el-cascader>
+        <div class="form-title" v-else-if="i.type == 'title'">
+          {{ i.title }}
+        </div>
+        <slot :name="i.slotName" v-else-if="i.type == 'slot'">
+          {{ i.slotName }}插槽占位符
+        </slot>
+        <div v-else-if="i.type == 'json'">
+          <byForm
+            :formConfig="i.json"
+            :formOption="formOption"
+            v-model="formData[i.prop]"
+            ref="byform"
+          >
+          </byForm>
+        </div>
+      </el-form-item>
+    </el-form>
+  </div>
 </template>
 <script>
-	export default {
-	  name: "byForm", 
-	}
+export default {
+  name: "byForm",
+};
 </script>
 <script  setup>
-import { set } from '@vueuse/shared'
-import { reactive } from 'vue'
+import { set } from "@vueuse/shared";
+import { reactive } from "vue";
 defineProps({
-	modelValue: {
-		type: Object,
-		default: false,
-	},
-	formConfig: {
-		type: Array,
-		default: false,
-	},
-	disabled: {
-		type: Boolean,
-		default: false,
-	},
-	formOption: {
-		type: Object,
-		default: false,
-	},
-	rules: {
-		type: Object,
-		default: false,
-	},
-})
+  modelValue: {
+    type: Object,
+    default: false,
+  },
+  formConfig: {
+    type: Array,
+    default: false,
+  },
+  disabled: {
+    type: Boolean,
+    default: false,
+  },
+  formOption: {
+    type: Object,
+    default: false,
+  },
+  rules: {
+    type: Object,
+    default: false,
+  },
+});
 
-const isInit = ref(false)
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['update:modelValue'])
+const isInit = ref(false);
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["update:modelValue"]);
 const formData = computed(() => {
-	return proxy.modelValue	
-})
-const formDataReset = ref({...proxy.modelValue})
-const commonsEmit = (prop,item) => {
-	console.log(formData)
-	if(item.fn) {
-		item.fn(prop)
-	}
-	emit('update:modelValue', formData.value)
-}
+  return proxy.modelValue;
+});
+const formDataReset = ref({ ...proxy.modelValue });
+const commonsEmit = (prop, item) => {
+  console.log(formData);
+  if (item.fn) {
+    item.fn(prop);
+  }
+  emit("update:modelValue", formData.value);
+};
 const loadInit = () => {
-	const v = this
-	for (let i = 0; i < proxy.formConfig.length; i++) {
-		const element = proxy.formConfig[i]
-		if (element.isLoad) {
-			commonGetdata(element.isLoad, i)
-		}
-	}
-}
-const dateFormatInit = ((itemType) => {
-	const formatObj = {
-		year:"YYYY",
-		month:"YYYY-MM",
-		date:"YYYY-MM-DD hh:mm:ss",
-		dates:'YYYY-MM-DD',
-		datetime:"YYYY-MM-DD hh:mm:ss",
-		monthrange:"YYYY-MM-DD hh:mm:ss",
-		datetimerange:"YYYY-MM-DD hh:mm:ss",
-		daterange:"YYYY-MM-DD hh:mm:ss",
-	}
-	console.log(formatObj)
-	return formatObj[itemType]
-})
+  const v = this;
+  for (let i = 0; i < proxy.formConfig.length; i++) {
+    const element = proxy.formConfig[i];
+    if (element.isLoad) {
+      commonGetdata(element.isLoad, i);
+    }
+  }
+};
+const dateFormatInit = (itemType) => {
+  const formatObj = {
+    year: "YYYY",
+    month: "YYYY-MM",
+    date: "YYYY-MM-DD hh:mm:ss",
+    dates: "YYYY-MM-DD",
+    datetime: "YYYY-MM-DD hh:mm:ss",
+    monthrange: "YYYY-MM-DD hh:mm:ss",
+    datetimerange: "YYYY-MM-DD hh:mm:ss",
+    daterange: "YYYY-MM-DD hh:mm:ss",
+  };
+  console.log(formatObj);
+  return formatObj[itemType];
+};
 
 //公用递归,保证key,val统一
 const commonRecursive = (arr, labelKey, labelVal, childrenName) => {
-	for (let i = 0; i < arr.length; i++) {
-		console.log(arr[i])
-		if(labelKey == 'stringArray'){
-			arr[i] = {
-				label:arr[i],
-				value:arr[i],
-				id:arr[i],
-				title:arr[i],
-			}
-		}else{
-			arr[i].title = arr[i].label = arr[i][labelKey]
-			arr[i].id = arr[i].value = arr[i][labelVal]
-		}
-		
-		if (childrenName) {
-			arr[i].children = arr[i][childrenName]
-		}
-		arr[i].checked = false
-		typeof arr[i][labelVal] == String
-			? (arr[i].key = arr[i][labelVal])
-			: (arr[i].key = JSON.stringify(arr[i][labelVal]))
-		if (childrenName) {
-			this.commonRecursive(
-				arr[i][childrenName],
-				labelKey,
-				labelVal,
-				childrenName
-			)
-		}
-	}
-}
+  for (let i = 0; i < arr.length; i++) {
+    console.log(arr[i]);
+    if (labelKey == "stringArray") {
+      arr[i] = {
+        label: arr[i],
+        value: arr[i],
+        id: arr[i],
+        title: arr[i],
+      };
+    } else {
+      arr[i].title = arr[i].label = arr[i][labelKey];
+      arr[i].id = arr[i].value = arr[i][labelVal];
+    }
 
-//请求form表单所需数据字典
-const commonGetdata = (isLoad,i) => {
-	proxy[isLoad.method](isLoad.url,isLoad.req).then(message=>{
-		console.log(message)
-		if (getFormat(isLoad.resUrl, message) == undefined) {
-			console.log('请查看isLoad配置是否正确url:' + isLoad.url)
-			return
-		}
-		proxy.formConfig[i].data = getFormat(isLoad.resUrl, message)
-		if (isLoad.labelKey) {
-			commonRecursive(
-				proxy.formConfig[i].data,
-				isLoad.labelKey,
-				isLoad.labelVal,
-				isLoad.childrenName
-			)
-		}
-		console.log(proxy.formConfig[i].data)
-	})
-}
+    if (childrenName) {
+      arr[i].children = arr[i][childrenName];
+    }
+    arr[i].checked = false;
+    typeof arr[i][labelVal] == String
+      ? (arr[i].key = arr[i][labelVal])
+      : (arr[i].key = JSON.stringify(arr[i][labelVal]));
+    if (childrenName) {
+      this.commonRecursive(
+        arr[i][childrenName],
+        labelKey,
+        labelVal,
+        childrenName
+      );
+    }
+  }
+};
 
+//请求form表单所需数据字典
+const commonGetdata = (isLoad, i) => {
+  proxy[isLoad.method](isLoad.url, isLoad.req).then((message) => {
+    console.log(message);
+    if (getFormat(isLoad.resUrl, message) == undefined) {
+      console.log("请查看isLoad配置是否正确url:" + isLoad.url);
+      return;
+    }
+    proxy.formConfig[i].data = getFormat(isLoad.resUrl, message);
+    if (isLoad.labelKey) {
+      commonRecursive(
+        proxy.formConfig[i].data,
+        isLoad.labelKey,
+        isLoad.labelVal,
+        isLoad.childrenName
+      );
+    }
+    console.log(proxy.formConfig[i].data);
+  });
+};
 
 //根据resurl获取数据
 const getFormat = (formatStr, props) => {
-	if(!formatStr)  return props
-	return formatStr
-		.split('.')
-		.reduce((total, cur) => (!total ? '' : total[cur]), props)
-}
+  if (!formatStr) return props;
+  return formatStr
+    .split(".")
+    .reduce((total, cur) => (!total ? "" : total[cur]), props);
+};
 
 //初始化所有表单
 
 const formDataInit = () => {
-	
-	
-	var map = {
-		input: '',
-		radio: null,
-		select: null,
-		checkbox: [],
-		date: '',
-		datetime: '',
-		daterange: [],
-		datetimerange: [],
-		year: null,
-		month: null,
-		switch: false,
-		inputNumber: 0,
-		cascader: [],
-		Solt: null,
-		Transfer: [],
-		Upload: { path: null, id: null, name: null },
-		password:'',
-		treeSelect:'',
-		json:{},
-	}
-	const formDataCopy = { ...formData.value }
-	for (let i = 0; i < proxy.formConfig.length; i++) {
-		const element = proxy.formConfig[i]
-		
-		if(formDataCopy[element.prop] || element.type === 'slot') {
-			continue
-		}
-			
-		if(map[element.itemType] != undefined){
-			formData.value[element.prop] = map[element.itemType]
-		}else{
-			formData.value[element.prop] = element.multiple ? [] :  map[element.type]
-		}
-		
-	}
-	
-	emit('update:modelValue', formData.value)
-}
+  var map = {
+    input: "",
+    radio: null,
+    select: null,
+    checkbox: [],
+    date: "",
+    datetime: "",
+    daterange: [],
+    datetimerange: [],
+    year: null,
+    month: null,
+    switch: false,
+    inputNumber: 0,
+    cascader: [],
+    Solt: null,
+    Transfer: [],
+    Upload: { path: null, id: null, name: null },
+    password: "",
+    treeSelect: "",
+    json: {},
+  };
+  const formDataCopy = { ...formData.value };
+  for (let i = 0; i < proxy.formConfig.length; i++) {
+    const element = proxy.formConfig[i];
+
+    if (formDataCopy[element.prop] || element.type === "slot") {
+      continue;
+    }
+
+    if (map[element.itemType] != undefined) {
+      formData.value[element.prop] = map[element.itemType];
+    } else {
+      formData.value[element.prop] = element.multiple ? [] : map[element.type];
+    }
+  }
+
+  emit("update:modelValue", formData.value);
+};
 
 const handleSubmit = (onSubmit) => {
-	proxy.$refs['byForm'].validate((valid) => {
-		if (valid) {
-			const form = { ...formData.value }
-			proxy.formConfig.map(item => {
-				if(item.type == 'json') {
-					form[item.prop] = JSON.stringify(form[item.prop])
-				}
-			})
-			emit('update:modelValue', form)
-			onSubmit()
-		// } else {
-		// 	ElMessage({
-		// 		message: '请检查表单',
-		// 		type: 'warning',
-		// 	})
-		}
-	})
-}
-const byform = ref(null) // 延迟使用,因为还没有返回跟挂载
-onMounted(()=>{
-	
-})
+  proxy.$refs["byForm"].validate((valid) => {
+    if (valid) {
+      const form = { ...formData.value };
+      proxy.formConfig.map((item) => {
+        if (item.type == "json") {
+          form[item.prop] = JSON.stringify(form[item.prop]);
+        }
+      });
+      emit("update:modelValue", form);
+      onSubmit();
+      // } else {
+      // 	ElMessage({
+      // 		message: '请检查表单',
+      // 		type: 'warning',
+      // 	})
+    }
+    return valid; //无论是否验证通过都返回
+  });
+};
+const byform = ref(null); // 延迟使用,因为还没有返回跟挂载
+onMounted(() => {});
 defineExpose({
-	handleSubmit,
-})
-formDataInit()
-loadInit()
+  handleSubmit,
+});
+formDataInit();
+loadInit();
 </script>
 
 <style>
-
 .form-title {
-	font-size: 14px;
-	font-weight: bold;
-	margin-top: 22px;
-	color: #333333;
+  font-size: 14px;
+  font-weight: bold;
+  margin-top: 22px;
+  color: #333333;
 }
 .by-form .el-form--inline .el-form-item {
-	margin-right: 0px;
-	padding-right: 32px;
-	box-sizing: border-box;
+  margin-right: 0px;
+  padding-right: 32px;
+  box-sizing: border-box;
 }
 
-.dn{
-	display: none!important;
+.dn {
+  display: none !important;
 }
-
-
 </style>

+ 391 - 392
src/components/byTable/demo.vue

@@ -1,419 +1,418 @@
 <template>
-	<div class="box-container">
-		<!-- <Banner /> -->
-		<div class="content">
-			<byTable
-				ref="singleTable"
-				:source="sourceList.data"
-				:pagination="sourceList.pagination"
-				:config="config"
-				:loading="loading"
-				:height="tableHeight"
-				highlight-current-row
-				:selectConfig="selectConfig"
-				:table-events="{
-					//element talbe事件都能传
-					'row-click': handleRowClick,
-					'cell-contextmenu': handleRowClick.apply,
-					'select-all': select,
-				}"
-				:action-list="[
-					{
-						text: '新建合同',
-						plain: true,
-						type: 'warning',
-						action: () => openModal('add'),
-					},
-				]"
-				@get-list="getList"
-			>
-				<template #slotName="{ item }">
-					{{ item.createTime }}
-				</template>
-			</byTable>
-		</div>
-		<el-dialog
-			:title="modalType == 'add' ? '新增' : '编辑'"
-			v-model="dialogVisible"
-			width="500"
-			:before-close="handleClose"
-		>
-			<byForm
-				:formConfig="formConfig"
-				:formOption="formOption"
-				v-model="formData"
-			>
-				<template #slot> 可自定义所需功能 </template>
-			</byForm>
-			<template #footer>
-				<span class="dialog-footer">
-					<el-button @click="dialogVisible = false">取 消</el-button>
-					<el-button type="primary" @click="dialogVisible = false"
-						>确 定</el-button
-					>
-				</span>
-			</template>
-		</el-dialog>
-	</div>
+  <div class="box-container">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        ref="singleTable"
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        :height="tableHeight"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          'row-click': handleRowClick,
+          'cell-contextmenu': handleRowClick.apply,
+          'select-all': select,
+        }"
+        :action-list="[
+          {
+            text: '新建合同',
+            plain: true,
+            type: 'warning',
+            action: () => openModal('add'),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '新增' : '编辑'"
+      v-model="dialogVisible"
+      width="500"
+      :before-close="handleClose"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData"
+      >
+        <template #slot> 可自定义所需功能 </template>
+      </byForm>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="dialogVisible = false">取 消</el-button>
+          <el-button type="primary" @click="dialogVisible = false"
+            >确 定</el-button
+          >
+        </span>
+      </template>
+    </el-dialog>
+  </div>
 </template>
   
 <script setup>
 /* eslint-disable vue/no-unused-components */
-import { ElMessage, ElMessageBox } from 'element-plus'
-import byTable from '@/components/byTable/index'
-import byForm from '@/components/byForm/index'
-import { computed, defineComponent, ref } from 'vue'
-const loading = ref(false)
-const fixedRight = ref('right')
-const align = ref('center')
-const tableHeight = ref(null)
-const border = ref(true)
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { computed, defineComponent, ref } from "vue";
+const loading = ref(false);
+const fixedRight = ref("right");
+const align = ref("center");
+const tableHeight = ref(null);
+const border = ref(true);
 const sourceList = ref({
-	data: [],
-	pagination: {
-		total: 3,
-		pageNum: 1,
-		pageSize: 10,
-	},
-})
-const singleTable = ref({})
-const dialogVisible = ref(false)
-const modalType = ref('add')
-const { proxy } = getCurrentInstance()
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+const singleTable = ref({});
+const dialogVisible = ref(false);
+const modalType = ref("add");
+const { proxy } = getCurrentInstance();
 const selectConfig = computed(() => {
-	return [
-		{
-			label: '合同状态1',
-			prop: 'tdaProductId',
+  return [
+    {
+      label: "合同状态1",
+      prop: "tdaProductId",
 
-			data: [
-				{
-					label: '已关闭',
-					value: '123',
-				},
-			],
-		},
-		{
-			label: '合同状态22',
-			prop: 'tdaApplicationId',
-			data: [
-				{
-					label: '已关闭',
-					value: '123',
-				},
-			],
-		},
-	]
-})
+      data: [
+        {
+          label: "已关闭",
+          value: "123",
+        },
+      ],
+    },
+    {
+      label: "合同状态22",
+      prop: "tdaApplicationId",
+      data: [
+        {
+          label: "已关闭",
+          value: "123",
+        },
+      ],
+    },
+  ];
+});
 const config = computed(() => {
-	return [
-		{
-			type: 'selection',
-			attrs: {
-				label: '角色名称',
-				prop: 'remark',
-			},
-		},
-		{
-			attrs: {
-				label: '权限字符',
-				prop: 'roleKey',
-			},
-		},
-		{
-			attrs: {
-				label: '显示顺序',
-				prop: 'dataScope',
-				align: 'center',
-				width: 200,
-			},
-			// 渲染字符串,默认不想展示 prop 的值,而是想对它做一些处理的时候,可以用这个方法
-			render(isForbid) {
-				return isForbid ? '禁用中' : '非禁用'
-			},
-		},
-		{
-			attrs: {
-				label: '状态',
-				align: align.value,
-				width: 100,
-				click: (items) => {
-					console.log(items)
-				},
-			},
-			// 渲染组件,返回值为一个数组, data 作为组件的 v-model,适用于需要展示复杂的数据的场景
-			renderComponent(row) {
-				return [
-					{
-						name: 'el-switch',
-						data: row.menuCheckStrictly,
-						change: (e) => {
-							console.log(e, 'change事件')
-						},
-						click: (e) => {
-							console.log(e, 'click事件')
-						},
-					},
-				]
-			},
-		},
-		{
-			attrs: {
-				label: '创建时间',
-				align: align.value,
-				width: 200,
-				prop: 'createTime',
-				slot: 'slotName',
-			},
-		},
-		{
-			attrs: {
-				label: '操作',
-				width: '400',
-				align: align.value,
-				// 设置当前列恢复点击事件冒泡
-				// isBubble: false,
-				fixed: fixedRight.value,
-			},
-			// 渲染 el-button,一般用在最后一列。
-			renderHTML(row) {
-				return [
-					{
-						attrs: {
-							label: '修改',
-							type: 'primary',
-							text: true,
-							bg: true,
-						},
-						el: 'button',
-						click() {
-							ElMessage({
-								message: JSON.stringify(row),
-							})
-						},
-					},
-					{
-						attrs: {
-							label: '删除',
-							type: 'danger',
-							text: true,
-							bg: true,
-						},
-						el: 'button',
-						click() {
-							ElMessage({
-								message: `编号${row.id} router -> 已跳转到编辑页面!`,
-							})
-						},
-					},
-					// {
-					// 	attrs: {
-					// 		label: '发布',
-					// 		type: 'primary',
-					// 		text: true,
-					// 		bg: true,
-					// 	},
-					// 	el: 'button',
-					// 	click() {
-					// 		setPublish(row)
-					// 	},
-					// },
-					// !row.isForbid
-					// 	? {
-					// 			attrs: {
-					// 				label: '三元写法ture',
-					// 				type: 'primary',
-					// 				text: true,
-					// 				bg: true,
-					// 				disabled: false,
-					// 			},
-					// 			el: 'button',
-					// 			click() {
-					// 				setForbid(row)
-					// 			},
-					// 	  }
-					// 	: {
-					// 			attrs: {
-					// 				label: '三元写法false',
-					// 				text: true,
-					// 				bg: true,
-					// 				type: 'primary',
-					// 				disabled: false,
-					// 				style: {
-					// 					color: '#e6a23c',
-					// 				},
-					// 			},
-					// 			el: 'button',
-					// 			click() {
-					// 				setForbid(row)
-					// 			},
-					// 	  },
-				]
-			},
-		},
-	]
-})
+  return [
+    {
+      type: "selection",
+      attrs: {
+        checkAtt: "isCheck",
+      },
+    },
+    {
+      attrs: {
+        label: "权限字符",
+        prop: "roleKey",
+      },
+    },
+    {
+      attrs: {
+        label: "显示顺序",
+        prop: "dataScope",
+        align: "center",
+        width: 200,
+      },
+      // 渲染字符串,默认不想展示 prop 的值,而是想对它做一些处理的时候,可以用这个方法
+      render(isForbid) {
+        return isForbid ? "禁用中" : "非禁用";
+      },
+    },
+    {
+      attrs: {
+        label: "状态",
+        align: align.value,
+        width: 100,
+        click: (items) => {
+          console.log(items);
+        },
+      },
+      // 渲染组件,返回值为一个数组, data 作为组件的 v-model,适用于需要展示复杂的数据的场景
+      renderComponent(row) {
+        return [
+          {
+            name: "el-switch",
+            data: row.menuCheckStrictly,
+            change: (e) => {
+              console.log(e, "change事件");
+            },
+            click: (e) => {
+              console.log(e, "click事件");
+            },
+          },
+        ];
+      },
+    },
+    {
+      attrs: {
+        label: "创建时间",
+        align: align.value,
+        width: 200,
+        prop: "createTime",
+        slot: "slotName",
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "400",
+        align: align.value,
+        // 设置当前列恢复点击事件冒泡
+        // isBubble: false,
+        fixed: fixedRight.value,
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+              bg: true,
+            },
+            el: "button",
+            click() {
+              ElMessage({
+                message: JSON.stringify(row),
+              });
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+              bg: true,
+            },
+            el: "button",
+            click() {
+              ElMessage({
+                message: `编号${row.id} router -> 已跳转到编辑页面!`,
+              });
+            },
+          },
+          // {
+          // 	attrs: {
+          // 		label: '发布',
+          // 		type: 'primary',
+          // 		text: true,
+          // 		bg: true,
+          // 	},
+          // 	el: 'button',
+          // 	click() {
+          // 		setPublish(row)
+          // 	},
+          // },
+          // !row.isForbid
+          // 	? {
+          // 			attrs: {
+          // 				label: '三元写法ture',
+          // 				type: 'primary',
+          // 				text: true,
+          // 				bg: true,
+          // 				disabled: false,
+          // 			},
+          // 			el: 'button',
+          // 			click() {
+          // 				setForbid(row)
+          // 			},
+          // 	  }
+          // 	: {
+          // 			attrs: {
+          // 				label: '三元写法false',
+          // 				text: true,
+          // 				bg: true,
+          // 				type: 'primary',
+          // 				disabled: false,
+          // 				style: {
+          // 					color: '#e6a23c',
+          // 				},
+          // 			},
+          // 			el: 'button',
+          // 			click() {
+          // 				setForbid(row)
+          // 			},
+          // 	  },
+        ];
+      },
+    },
+  ];
+});
 
-const formData = reactive({})
+const formData = reactive({});
 const formOption = reactive({
-	inline: true,
-	labelWidth: 100,
-	itemWidth: 100,
-	rules: [],
-})
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
 const formConfig = computed(() => {
-	return [
-		{
-			type: 'input',
-			prop: 'name',
-			label: 'label名称',
-			required: true,
-			itemWidth: 100,
-			//disabled:true,
-			itemType: 'textarea',
-		},
-		{
-			type: 'select',
-			prop: 'xiala',
-			label: '下拉框',
-			multiple: true,
-			style: {
-				width: '300px',
-			},
-			isLoad: {
-				url: '/getRouters',
-				resUrl: 'data',
-				//如果接口回来为stringArray,可以把labelkey和labelval都设置为stringArray
-				labelKey: 'name',
-				labelVal: 'path',
-			},
-			//所有组件的change事件监听
-			fn: (e) => {
-				console.log(e)
-			},
-		},
-		{
-			type: 'date',
-			prop: 'date',
-			label: '时间',
-			itemType: 'date',
-		},
-		{
-			type: 'radio',
-			prop: 'radio',
-			label: '单选',
-		},
-		{
-			type: 'slot',
-			slotName: 'slot',
-			label: '插槽',
-		},
-		
-		{
-			//使用此功能需要初始化prop数据至少是对象
-			type: 'json',
-			prop: 'standardJson',
-			json: [
-				{
-					type: 'input',
-					prop: 'englishName',
-					label: '英文名',
-				},
-				{
-					type: 'input',
-					prop: 'code',
-					label: '备注',
-				},
-				{
-					type: 'input',
-					prop: 'netWeight',
-					label: '净重',
-				},
-				{
-					type: 'input',
-					prop: 'customhouse',
-					label: '海关编码',
-				},
-			],
-		},
-	]
-})
+  return [
+    {
+      type: "input",
+      prop: "name",
+      label: "label名称",
+      required: true,
+      itemWidth: 100,
+      //disabled:true,
+      itemType: "textarea",
+    },
+    {
+      type: "select",
+      prop: "xiala",
+      label: "下拉框",
+      multiple: true,
+      style: {
+        width: "300px",
+      },
+      isLoad: {
+        url: "/getRouters",
+        resUrl: "data",
+        //如果接口回来为stringArray,可以把labelkey和labelval都设置为stringArray
+        labelKey: "name",
+        labelVal: "path",
+      },
+      //所有组件的change事件监听
+      fn: (e) => {
+        console.log(e);
+      },
+    },
+    {
+      type: "date",
+      prop: "date",
+      label: "时间",
+      itemType: "date",
+    },
+    {
+      type: "radio",
+      prop: "radio",
+      label: "单选",
+    },
+    {
+      type: "slot",
+      slotName: "slot",
+      label: "插槽",
+    },
+
+    {
+      //使用此功能需要初始化prop数据至少是对象
+      type: "json",
+      prop: "standardJson",
+      json: [
+        {
+          type: "input",
+          prop: "englishName",
+          label: "英文名",
+        },
+        {
+          type: "input",
+          prop: "code",
+          label: "备注",
+        },
+        {
+          type: "input",
+          prop: "netWeight",
+          label: "净重",
+        },
+        {
+          type: "input",
+          prop: "customhouse",
+          label: "海关编码",
+        },
+      ],
+    },
+  ];
+});
 
 const sleep = (time = 1000) => {
-	return new Promise((resolve) => setTimeout(resolve, time))
-}
+  return new Promise((resolve) => setTimeout(resolve, time));
+};
 const getList = async (res) => {
-	console.log(sourceList.value)
-	console.log({ ...sourceList.value.pagination, ...res })
-	loading.value = true
-	proxy.get('/system/role/list?pageNum=1&pageSize=10').then((message) => {
-		console.log(message)
-		sourceList.value.data = message.rows
-		setTimeout(() => {
-			loading.value = false
-		}, 200)
-	})
-}
+  console.log(sourceList.value);
+  console.log({ ...sourceList.value.pagination, ...res });
+  loading.value = true;
+  proxy.get("/system/role/list?pageNum=1&pageSize=10").then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
 const openModal = () => {
-	dialogVisible.value = true
-}
+  dialogVisible.value = true;
+};
 const select = (row, column, cell) => {
-	ElMessage({
-		dangerouslyUseHTMLString: true, // Be careful :)
-		message: `点了全选`,
-	})
-}
+  ElMessage({
+    dangerouslyUseHTMLString: true, // Be careful :)
+    message: `点了全选`,
+  });
+};
 const handleRowClick = (row, column, cell) => {
-	ElMessage({
-		dangerouslyUseHTMLString: true, // Be careful :)
-		message: `row-click 事件,单击了<span style="color: red;"> 第${row.$index}行 </span>请看控制台 log`,
-	})
-	console.log('回调参数分别为: row, column, cell')
-	console.log(row, column, cell)
-}
+  ElMessage({
+    dangerouslyUseHTMLString: true, // Be careful :)
+    message: `row-click 事件,单击了<span style="color: red;"> 第${row.$index}行 </span>请看控制台 log`,
+  });
+  console.log("回调参数分别为: row, column, cell");
+  console.log(row, column, cell);
+};
 const setPublish = (row) => {
-	ElMessageBox.confirm(
-		`此操作会将${row.name}发布到线上, 是否继续?`,
-		`编号${row.id}提示`,
-		{
-			confirmButtonText: '确定',
-			cancelButtonText: '取消',
-			type: 'warning',
-		}
-	)
-		.then(() => {
-			ElMessage({
-				type: 'success',
-				message: '发布成功!',
-			})
-		})
-		.catch(() => {
-			ElMessage({
-				type: 'info',
-				message: '已取消发布',
-			})
-		})
-}
+  ElMessageBox.confirm(
+    `此操作会将${row.name}发布到线上, 是否继续?`,
+    `编号${row.id}提示`,
+    {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning",
+    }
+  )
+    .then(() => {
+      ElMessage({
+        type: "success",
+        message: "发布成功!",
+      });
+    })
+    .catch(() => {
+      ElMessage({
+        type: "info",
+        message: "已取消发布",
+      });
+    });
+};
 const setForbid = async (row) => {
-	loading.value = true
-	await sleep()
-	loading.value = false
-	row.isForbid = !row.isForbid
-}
+  loading.value = true;
+  await sleep();
+  loading.value = false;
+  row.isForbid = !row.isForbid;
+};
 const copyLink = (row) => {
-	ElMessage({
-		type: 'success',
-		message: '指令测试-复制成功,可以粘贴啦!',
-	})
-}
-getList()
+  ElMessage({
+    type: "success",
+    message: "指令测试-复制成功,可以粘贴啦!",
+  });
+};
+getList();
 </script>
   
   <style lang="scss" scoped>
 .box-container {
-	.content {
-		position: relative;
-		margin: 0 auto;
-	}
+  .content {
+    position: relative;
+    margin: 0 auto;
+  }
 }
 </style>

+ 14 - 0
src/components/byTable/index.vue

@@ -93,6 +93,9 @@
           :key="index"
           v-bind="getAttrsValue(item)"
           :type="item.type || ''"
+          :selectable="
+            (rowData, rowIndex) => isSelectable(rowData, rowIndex, item)
+          "
         >
           <template #default="scope" v-if="!item.type">
             <slot
@@ -393,6 +396,16 @@ export default defineComponent({
       );
     };
 
+    const isSelectable = (row, index, item) => {
+      if (item.type === "selection") {
+        if (row[item.attrs.checkAtt]) {
+          return true;
+        }
+      } else {
+        return true;
+      }
+    };
+
     return {
       getParent,
       getPagination,
@@ -412,6 +425,7 @@ export default defineComponent({
       searchFn,
       searchItemSelct,
       selectConfigCopy,
+      isSelectable,
     };
   },
 });

+ 192 - 0
src/components/process/ReturnGood.vue

@@ -0,0 +1,192 @@
+<template>
+  <div style="width: 100%; padding: 0px 15px">
+    <byForm
+      :formConfig="formConfig"
+      :formOption="formOption"
+      v-model="formData.data"
+      :rules="rules"
+      ref="formDom"
+    >
+      <template #details>
+        <div>
+          <el-button type="primary" @click="openProduct = true">
+            添加物品
+          </el-button>
+          <el-table :data="formData.data.purchaseDetailList">
+            <el-table-column prop="productCode" label="货品编码" />
+            <el-table-column prop="productName" label="货品名称" />
+            <el-table-column prop="productSpec" label="规格型号" />
+            <el-table-column prop="productUnit" label="单位" />
+
+            <el-table-column prop="price" label="退货数量" min-width="150">
+              <template #default="{ row, $index }">
+                <el-form-item
+                  :prop="'purchaseDetailList.' + $index + '.price'"
+                  :rules="rules.price"
+                  :inline-message="true"
+                >
+                  <el-input-number
+                    v-model="row.price"
+                    :precision="4"
+                    :controls="false"
+                    :min="0"
+                  />
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column prop="price" label="退货原因" min-width="150">
+              <template #default="{ row, $index }">
+                <el-form-item
+                  :prop="'purchaseDetailList.' + $index + '.price'"
+                  :rules="rules.price"
+                  :inline-message="true"
+                >
+                  <el-input v-model="row.price" placeholder="请输入" />
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column prop="zip" label="操作" width="100">
+              <template #default="{ $index }">
+                <el-button type="primary" link @click="handleRemove($index)"
+                  >删除</el-button
+                >
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </template>
+    </byForm>
+    <el-dialog
+      v-model="openProduct"
+      title="选择货品"
+      width="70%"
+      append-to-body
+    >
+      <SelectGoods
+        @cancel="openProduct = false"
+        @pushGoods="pushGoods"
+      ></SelectGoods>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import byForm from "@/components/byForm/index";
+import SelectGoods from "@/components/product/SelectGoods";
+
+let formData = reactive({
+  data: {
+    name: "",
+    processRouteList: [],
+    remarks: "",
+    productList: [],
+  },
+});
+let rules = ref({
+  name: [{ required: true, message: "请输入工艺名称", trigger: "blur" }],
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "name",
+      label: "申请部门",
+      itemWidth: 25,
+      style: {
+        "margin-right": "10px",
+      },
+    },
+    {
+      type: "input",
+      prop: "name",
+      label: "申请人",
+      itemWidth: 25,
+      style: {
+        "margin-right": "10px",
+      },
+    },
+    {
+      type: "date",
+      prop: "name",
+      label: "申请时间",
+      itemWidth: 25,
+      style: {
+        "margin-right": "10px",
+      },
+    },
+    {
+      type: "select",
+      prop: "productId",
+      label: "供应商",
+      isLoad: {
+        url: "/supplierInfo/page",
+        req: {
+          pageNum: 1,
+          pageSize: 9999,
+        },
+        labelKey: "name",
+        labelVal: "id",
+        method: "post",
+        resUrl: "rows",
+      },
+    },
+    {
+      type: "slot",
+      slotName: "details",
+      label: "退货明细",
+    },
+  ];
+});
+const formDom = ref(null);
+const handleSubmit = async () => {
+  formDom.value.handleSubmit((vaild) => {
+    console.log(vaild, "wsdaws");
+  });
+};
+let openProduct = ref(false);
+const handleRemove = (index) => {
+  formData.data.purchaseDetailList.splice(index, 1);
+  return ElMessage({
+    message: "删除成功!",
+    type: "success",
+  });
+};
+const pushGoods = (goods) => {
+  const arr = goods.map((x) => ({
+    goodType: x.goodType,
+    productCode: x.code,
+    productName: x.name,
+    productSpec: x.spec,
+    productUnit: x.unit,
+    count: 0,
+    price: 0,
+    bussinessId: x.id,
+    amount: 0,
+  }));
+  formData.data.purchaseDetailList =
+    formData.data.purchaseDetailList.concat(arr);
+  return ElMessage({
+    message: "添加成功!",
+    type: "success",
+  });
+};
+
+// 接收父组件的传值
+const props = defineProps({
+  queryData: String,
+});
+
+// 向父组件暴露
+defineExpose({
+  submitData: formData.data,
+  handleSubmit,
+});
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 46 - 38
src/components/process/SendFunds.vue

@@ -26,12 +26,12 @@
           </el-form-item>
         </el-col>
         <el-col :span="6">
-          <el-form-item label="归属部门" prop="corporationId">
+          <el-form-item label="归属部门" prop="departmentId">
             <el-cascader
-              v-model="formData.data.corporationId"
+              v-model="formData.data.departmentId"
               :options="deptTreeData"
               :props="{
-                value: 'id',
+                value: 'deptId',
               }"
               clearable
               filterable
@@ -60,9 +60,9 @@
           </el-form-item>
         </el-col>
         <el-col :span="6">
-          <el-form-item label="币种" prop="supplyId">
+          <el-form-item label="币种" prop="currency">
             <el-select
-              v-model="formData.data.supplyId"
+              v-model="formData.data.currency"
               placeholder="请选择"
               filterable
               style="width: 100%"
@@ -127,16 +127,16 @@
         <el-button type="primary" @click="handleAddRow" style="margin: 10px 0">
           添加行
         </el-button>
-        <el-table :data="formData.data.purchaseDetailList">
+        <el-table :data="formData.data.accountRequestFundsDetailList">
           <el-table-column prop="count" label="费用类型" min-width="150">
             <template #default="{ row, $index }">
               <el-form-item
-                :prop="'purchaseDetailList.' + $index + '.count'"
-                :rules="rules.count"
+                :prop="'accountRequestFundsDetailList.' + $index + '.costType'"
+                :rules="rules.costType"
                 :inline-message="true"
               >
                 <el-select
-                  v-model="formData.data.supplyId"
+                  v-model="row.costType"
                   placeholder="请选择"
                   filterable
                   style="width: 100%"
@@ -154,27 +154,27 @@
           <el-table-column prop="count" label="款项说明" min-width="150">
             <template #default="{ row, $index }">
               <el-form-item
-                :prop="'purchaseDetailList.' + $index + '.count'"
-                :rules="rules.count"
+                :prop="'accountRequestFundsDetailList.' + $index + '.remarks'"
+                :rules="rules.remarks"
                 :inline-message="true"
               >
                 <el-input
-                  v-model="row.count"
+                  v-model="row.remarks"
                   placeholder="请输入"
                   type="textarea"
                 />
               </el-form-item>
             </template>
           </el-table-column>
-          <el-table-column prop="count" label="请款金额" min-width="150">
+          <el-table-column prop="amount" label="请款金额" min-width="150">
             <template #default="{ row, $index }">
               <el-form-item
-                :prop="'purchaseDetailList.' + $index + '.count'"
-                :rules="rules.count"
+                :prop="'accountRequestFundsDetailList.' + $index + '.amount'"
+                :rules="rules.amount"
                 :inline-message="true"
               >
                 <el-input-number
-                  v-model="row.count"
+                  v-model="row.amount"
                   :precision="4"
                   :controls="false"
                   :min="0"
@@ -238,7 +238,7 @@
             >
               <el-option
                 v-for="item in accountData"
-                :label="item.name"
+                :label="item.alias"
                 :value="item.id"
               >
               </el-option>
@@ -292,31 +292,43 @@ const { proxy } = getCurrentInstance();
 let formData = reactive({
   data: {
     paymentTime: "",
-    purchaseDetailList: [],
+    accountRequestFundsDetailList: [],
   },
 });
 let rules = ref({
-  deptName: [{ required: true, message: "请输入采购部门", trigger: "blur" }],
-  purchaseName: [
-    { required: true, message: "请输入采购人名称", trigger: "blur" },
+  corporationId: [
+    { required: true, message: "请选择归属公司", trigger: "change" },
+  ],
+  departmentId: [
+    { required: true, message: "请选择归属部门", trigger: "change" },
   ],
+  type: [{ required: true, message: "请选择请款类型", trigger: "change" }],
   paymentTime: [
-    { required: true, message: "请选择采购时间", trigger: "change" },
+    { required: true, message: "请选择用款时间", trigger: "change" },
   ],
-  supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
-  count: [{ required: true, message: "请输入本次采购数量", trigger: "blur" }],
-  price: [{ required: true, message: "请输入单价", trigger: "blur" }],
-  remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
+  currency: [{ required: true, message: "请选择币种", trigger: "change" }],
+  paymentMethod: [
+    { required: true, message: "请选择付款方式", trigger: "change" },
+  ],
+  accountManagementId: [
+    { required: true, message: "请选择付款账号", trigger: "change" },
+  ],
+  costType: [{ required: true, message: "请选择费用类型", trigger: "change" }],
+  remarks: [{ required: true, message: "请输入款项说明", trigger: "blur" }],
+  amount: [{ required: true, message: "请输入请款金额", trigger: "blur" }],
 });
 
 const handleAddRow = () => {
-  formData.data.purchaseDetailList.push({
-    aa: "",
+  formData.data.accountRequestFundsDetailList.push({
+    costType: "",
+    remarks: "",
+    amount: 0,
   });
 };
 
 const handleRemove = (index) => {
-  formData.data.purchaseDetailList.splice(index, 1);
+  formData.data.accountRequestFundsDetailList.splice(index, 1);
+  handleChangeAmount();
 };
 
 // 提交方法
@@ -324,7 +336,7 @@ const formDom = ref(null);
 const handleSubmit = async () => {
   const vaild = await formDom.value.validate();
   if (vaild) {
-    if (formData.data.purchaseDetailList.length > 0) {
+    if (formData.data.accountRequestFundsDetailList.length > 0) {
       return true;
     }
     ElMessage({
@@ -333,7 +345,6 @@ const handleSubmit = async () => {
     });
     return false;
   }
-
   return false;
 };
 // 获取用户信息并赋默认值
@@ -343,8 +354,6 @@ const tenantId = "@福建宏星!#¥%……&*()";
 
 onMounted(() => {
   formData.data.paymentTime = proxy.parseTime(new Date());
-  formData.data.deptName = userInfo.dept.deptName;
-  formData.data.purchaseName = userInfo.nickName;
   getDictData();
 });
 const companyData = ref([]);
@@ -445,17 +454,16 @@ const props = defineProps({
 
 // 部门变更逻辑
 const handleChangeDept = (val) => {
-  formData.data.corporationId = val[val.length - 1];
+  formData.data.departmentId = val[val.length - 1];
 };
 // 计算请款总金额
 const handleChangeAmount = () => {
   let sum = 0;
-  for (let i = 0; i < formData.data.purchaseDetailList.length; i++) {
-    const e = formData.data.purchaseDetailList[i];
-    e.amount = e.count * e.price;
+  for (let i = 0; i < formData.data.accountRequestFundsDetailList.length; i++) {
+    const e = formData.data.accountRequestFundsDetailList[i];
     sum += e.amount;
   }
-  formData.data.amount = sum;
+  formData.data.total = sum;
 };
 // 上传附件
 const uploadData = ref({});

+ 51 - 14
src/views/WDLY/basic/product/index.vue

@@ -144,15 +144,17 @@
                   <el-input
                     v-model="formData.data.victoriatouristJson.newProductsDay"
                     placeholder="请输入"
-                  />
+                    @change="changeDay(10)"
+                  >
+                  </el-input>
                 </el-col>
                 <el-col :span="1" style="text-align: center"> : </el-col>
-                <el-col :span="4">
+                <el-col :span="6">
                   <el-input
                     v-model="
                       formData.data.victoriatouristJson.newProductsExpectedSales
                     "
-                    placeholder="请输入"
+                    placeholder="预期销量"
                   />
                 </el-col>
               </el-row>
@@ -171,10 +173,12 @@
                   <el-input
                     v-model="formData.data.victoriatouristJson.growUpDay"
                     placeholder="请输入"
-                  />
+                    @change="changeDay(20)"
+                  >
+                  </el-input>
                 </el-col>
                 <el-col :span="1" style="text-align: center"> : </el-col>
-                <el-col :span="4">
+                <el-col :span="6">
                   <el-input
                     v-model="
                       formData.data.victoriatouristJson.growUpExpectedSales
@@ -185,9 +189,11 @@
               </el-row>
             </el-form-item>
             <el-form-item label="成熟期">
-              <el-row>
-                <el-col :span="8"> 大于120天: </el-col>
-                <el-col :span="7">
+              <el-row style="width: 100%">
+                <el-col :span="5">
+                  大于{{ formData.data.victoriatouristJson.attDay }}天:
+                </el-col>
+                <el-col :span="6">
                   <el-input
                     v-model="
                       formData.data.victoriatouristJson.matureExpectedSales
@@ -532,6 +538,7 @@ const formConfig = computed(() => {
           prop: "clearancePeriod",
           label: "库存清空期限",
           itemWidth: 33.33,
+          format: "YYYY-MM-DD",
         },
       ],
     },
@@ -600,16 +607,17 @@ const openModal = () => {
     definition: "1",
     type: "1",
     fileList: [],
+    combination: "1",
     victoriatouristJson: {
       combination: 1,
-      newProductsDay1: "0",
-      newProductsDay: "60",
-      growUpDay1: "61",
-      growUpDay: "120",
+      newProductsDay1: 0,
+      newProductsDay: 60,
+      growUpDay1: 61,
+      growUpDay: 120,
+      attDay: 120,
     },
     productCombinationList: [],
   };
-
   fileList.value = [];
   fileListCopy.value = [];
 };
@@ -631,8 +639,26 @@ const select = (_selection, row) => {
 
 const tree = ref(null);
 const submitForm = () => {
-  console.log(byform.value);
   byform.value.handleSubmit((valid) => {
+    if (formData.data.combination == 1) {
+      if (!formData.data.productCombinationList.length > 0) {
+        return ElMessage({
+          message: "请添加组合明细",
+          type: "info",
+        });
+      }
+      formData.data.victoriatouristJson = JSON.parse(
+        formData.data.victoriatouristJson
+      );
+      formData.data.victoriatouristJson.productCombinationList =
+        formData.data.productCombinationList;
+      formData.data.victoriatouristJson.combination = formData.data.combination;
+      delete formData.data.productCombinationList;
+      delete formData.data.combination;
+      formData.data.victoriatouristJson = JSON.stringify(
+        formData.data.victoriatouristJson
+      );
+    }
     formData.data.fileList = fileListCopy.value.map((x) => ({
       id: x.id,
       fileName: x.fileName,
@@ -730,6 +756,17 @@ const pushGoods = (goods) => {
     type: "success",
   });
 };
+
+const changeDay = (type) => {
+  if (type == 10) {
+    formData.data.victoriatouristJson.growUpDay1 =
+      Number(formData.data.victoriatouristJson.newProductsDay) + 1;
+  } else if (type == 20) {
+    formData.data.victoriatouristJson.attDay = Number(
+      formData.data.victoriatouristJson.growUpDay
+    );
+  }
+};
 </script>
   
 <style lang="scss" scoped>

+ 352 - 0
src/views/WDLY/basic/spu/index.vue

@@ -0,0 +1,352 @@
+<template>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: '添加spu',
+            action: () => openModal('add'),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加spu' : '编辑'"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+        <template #products>
+          <div style="width: 100%">
+            <el-button
+              type="primary"
+              @click="openProduct = true"
+              style="margin-bottom: 10px"
+            >
+              添加产品
+            </el-button>
+            <el-table :data="formData.data.productInfos">
+              <el-table-column prop="name" label="产品编码" min-width="150" />
+              <el-table-column prop="name" label="产品名称" min-width="150" />
+              <el-table-column prop="zip" label="操作" width="100">
+                <template #default="{ $index }">
+                  <el-button type="primary" link @click="handleRemove($index)"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+    <el-dialog
+      v-model="openProduct"
+      title="选择产品"
+      width="70%"
+      append-to-body
+    >
+      <SelectProduct @handleSelect="handleSelect"></SelectProduct>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openProduct = false">取消</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { computed, defineComponent, ref } from "vue";
+import useUserStore from "@/store/modules/user";
+import SelectProduct from "@/components/product/SelectProduct";
+
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let openProduct = ref(false);
+
+let roomDialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  code: [{ required: true, message: "请输入spu编码", trigger: "blur" }],
+  name: [{ required: true, message: "请输入spu名称", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  // {
+  //   label: "spu类型",
+  //   prop: "type",
+  //   data: [],
+  // },
+]);
+
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "spu编码",
+        prop: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "spu名称",
+        prop: "name",
+      },
+    },
+    {
+      attrs: {
+        label: "备注",
+        prop: "remark",
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              // 弹窗提示是否删除
+              ElMessageBox.confirm(
+                "此操作将永久删除该数据, 是否继续?",
+                "提示",
+                {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning",
+                }
+              ).then(() => {
+                // 删除
+                proxy
+                  .post("/productSpu/delete", {
+                    id: row.id,
+                  })
+                  .then((res) => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {},
+  treeData: [],
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const treeData = ref([]);
+const formConfig = reactive([
+  {
+    type: "input",
+    prop: "code",
+    label: "spu编码",
+  },
+  {
+    type: "input",
+    prop: "name",
+    label: "spu名称",
+  },
+  {
+    type: "input",
+    itemType: "textarea",
+    prop: "remark",
+    label: "spu说明",
+  },
+  {
+    type: "slot",
+    slotName: "products",
+    prop: "keeperId",
+    label: "关联产品",
+  },
+]);
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/productSpu/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {
+    productInfos: [],
+  };
+};
+
+const submitForm = () => {
+  console.log(byform.value);
+  byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
+    proxy.post("/productSpu/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
+  });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/productSpu/detail", { id: row.id }).then((res) => {
+    res.productInfos = res.productInfoList;
+    formData.data = res;
+    dialogVisible.value = true;
+  });
+};
+
+const warehouseType = ref([]);
+const getDict = () => {
+  // // 币种数据
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      tenantId: useUserStore().user.tenantId,
+      dictCode: "warehouse_type",
+    })
+    .then((res) => {
+      warehouseType.value = res.rows;
+      selectConfig[0].data = res.rows.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+      formConfig[0].data = res.rows.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+    });
+};
+getList();
+// getDict();
+
+const handleSelect = (row) => {
+  const flag = formData.data.productInfos.some((x) => x.id === row.id);
+  if (flag)
+    return ElMessage({
+      message: "该产品已选择",
+      type: "info",
+    });
+  formData.data.productInfos.push({
+    name: row.name,
+    code: row.code,
+    id: row.id,
+  });
+  return ElMessage({
+    message: "选择成功",
+    type: "success",
+  });
+};
+
+const handleRemove = (index) => {
+  formData.data.productInfos.splice(index, 1);
+  return ElMessage({
+    message: "删除成功",
+    type: "success",
+  });
+};
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 12 - 17
src/views/finance/fundManage/funds/index.vue

@@ -181,13 +181,8 @@ const selectConfig = reactive([
   },
   {
     label: "放款状态",
-    prop: "status",
-    data: [
-      {
-        label: "未放款",
-        value: "10",
-      },
-    ],
+    prop: "paymentStatus",
+    data: [],
   },
 ]);
 const config = computed(() => {
@@ -408,16 +403,16 @@ const getDictData = () => {
     });
 
   // 部门树
-  proxy
-    .get("/tenantDept/list", {
-      pageNum: 1,
-      pageSize: 9999,
-      tenantId: userInfo.tenantId,
-    })
-    .then((message) => {
-      recursive(message.data);
-      deptTreeData.value = proxy.handleTree(message.data, "corporationId");
-    });
+  // proxy
+  //   .get("/tenantDept/list", {
+  //     pageNum: 1,
+  //     pageSize: 9999,
+  //     tenantId: userInfo.tenantId,
+  //   })
+  //   .then((message) => {
+  //     recursive(message.data);
+  //     deptTreeData.value = proxy.handleTree(message.data, "corporationId");
+  //   });
   // 请款类型数据
   proxy
     .post("/dictTenantData/page", {

+ 2 - 1
src/views/oa/mailList/interior/index.vue

@@ -345,7 +345,8 @@ const getDict = () => {
 };
 
 const getTypeData = (item, type) => {
-  return item.internalAddressBookList.filter((x) => x.type === type) || [];
+  if (item.internalAddressBookList)
+    return item.internalAddressBookList.filter((x) => x.type === type) || [];
 };
 
 getList();

+ 16 - 16
src/views/oa/mailList/outside/index.vue

@@ -241,7 +241,7 @@ const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
     label: "来源",
-    prop: "type",
+    prop: "enterpriseType",
     data: [
       {
         label: "客户",
@@ -291,7 +291,7 @@ const config = computed(() => {
       attrs: {
         type: "slot",
         slot: "phoneNumber",
-        label: "联系号码",
+        label: "手机号",
       },
     },
     {
@@ -301,18 +301,18 @@ const config = computed(() => {
         label: "电子邮箱",
       },
     },
-    {
-      attrs: {
-        label: "座机",
-        prop: "createTime",
-      },
-    },
-    {
-      attrs: {
-        label: "WhatsApp",
-        prop: "createTime",
-      },
-    },
+    // {
+    //   attrs: {
+    //     label: "座机",
+    //     prop: "createTime",
+    //   },
+    // },
+    // {
+    //   attrs: {
+    //     label: "WhatsApp",
+    //     prop: "createTime",
+    //   },
+    // },
 
     {
       attrs: {
@@ -588,8 +588,8 @@ const addRow = () => {
 };
 
 const getTypeData = (item, type) => {
-  // return item.internalAddressBookList.filter((x) => x.type === type) || [];
-  return [];
+  if (item.internalAddressBookList)
+    return item.internalAddressBookList.filter((x) => x.type === type) || [];
 };
 </script>
   

+ 9 - 8
src/views/process/processApproval/index.vue

@@ -17,6 +17,11 @@
           v-else-if="queryData.data.isSubscribe == '30'"
           :queryData="queryData.data"
         ></SendFunds>
+        <ReturnGood
+          ref="makeDom"
+          v-else-if="queryData.data.isSubscribe == '40'"
+          :queryData="queryData.data"
+        ></ReturnGood>
       </div>
       <div class="bottom">
         <div class="commons-title title">处理意见</div>
@@ -185,6 +190,8 @@ import SendSubscribe from "@/components/process/SendSubscribe";
 import SendPurchase from "@/components/process/SendPurchase";
 //请款发起
 import SendFunds from "@/components/process/SendFunds";
+//退货
+import ReturnGood from "@/components/process/ReturnGood";
 // 消息提示
 import { ElMessage, ElMessageBox } from "element-plus";
 // tab切换逻辑
@@ -256,14 +263,8 @@ const handleSubmit = async () => {
               handleResult(res);
             });
           } else if (queryData.data.isSubscribe == "30") {
-            data.purchaseDetailList = data.purchaseDetailList.map((x) => ({
-              bussinessId: x.bussinessId,
-              subscribeDetailId: x.id,
-              count: x.count,
-              price: x.price,
-              amount: x.amount,
-            }));
-            proxy.post("/purchase/add", data).then((res) => {
+            console.log(data, "wssaa");
+            proxy.post("/accountRequestFunds/start", data).then((res) => {
               handleResult(res);
             });
           }

+ 30 - 13
src/views/purchaseManage/purchaseManage/alreadyPurchase/index.vue

@@ -77,7 +77,7 @@
 
         <div style="margin-bottom: 10px; font-size: 14px">到货明细</div>
         <el-form-item>
-          <el-table :data="formData.data.purchaseDetailList">
+          <el-table :data="formData.data.arrivalDetailList">
             <el-table-column
               prop="goodType"
               label="货品类型"
@@ -87,12 +87,12 @@
             <el-table-column prop="productName" label="货品名称" />
             <el-table-column prop="productSpec" label="规格型号" />
             <el-table-column prop="productUnit" label="单位" />
-            <el-table-column prop="productUnit" label="采购数量" />
-            <el-table-column prop="productUnit" label="已到货" />
+            <el-table-column prop="purchaseCount" label="采购数量" />
+            <el-table-column prop="sumArrivalCount" label="已到货" />
             <el-table-column prop="count" label="本次到货" min-width="150">
               <template #default="{ row, $index }">
                 <el-form-item
-                  :prop="'purchaseDetailList.' + $index + '.count'"
+                  :prop="'arrivalDetailList.' + $index + '.count'"
                   :rules="rules.count"
                   :inline-message="true"
                 >
@@ -171,15 +171,15 @@ const selectConfig = reactive([
     data: [
       {
         label: "未到货",
-        value: "1",
+        value: "0",
       },
       {
         label: "部分到货",
-        value: "2",
+        value: "10",
       },
       {
         label: "已到货",
-        value: "3",
+        value: "20",
       },
     ],
   },
@@ -373,8 +373,8 @@ const getList = async (req) => {
 const submitForm = async () => {
   formDom.value.validate((vaild) => {
     if (vaild) {
-      const list = formData.data.purchaseDetailList;
-      const total = list.reduce((total, x) => (total += Number(x.e)));
+      const list = formData.data.arrivalDetailList;
+      const total = list.reduce((total, x) => (total += Number(x.count)));
       if (total < 1) {
         return ElMessage({
           message: `本次到货不能为0!`,
@@ -384,11 +384,22 @@ const submitForm = async () => {
       let sum = 0;
       for (let i = 0; i < list.length; i++) {
         const e = list[i];
-        if (Number(e.x) + Number(e.y) >= Number(e.v)) {
+        if (
+          Number(e.sumArrivalCount) + Number(e.count) >=
+          Number(e.purchaseCount)
+        ) {
           sum += 1;
         }
       }
-      formData.data.status = sum === list.length ? "10" : "20";
+      formData.data.arrivalStatus = sum === list.length ? "20" : "10";
+      proxy.post("/arrival/add", formData.data).then((res) => {
+        ElMessage({
+          message: `操作成功!`,
+          type: "success",
+        });
+        dialogVisible.value = true;
+        getList();
+      });
     }
   });
 };
@@ -441,10 +452,16 @@ const getSupplierList = async (req) => {
 const handleArrival = (row) => {
   proxy.post("/purchase/detail", { id: row.id }).then((res) => {
     formData.data = {
-      id: row.id,
+      purchaseId: row.id,
       code: res.code,
       supplyId: res.supplyId,
-      purchaseDetailList: res.purchaseDetailList,
+      arrivalDetailList: res.purchaseDetailList.map((x) => ({
+        ...x,
+        purchaseDetailId: x.id,
+        purchaseCount: x.count,
+        count: 0,
+      })),
+      arrivalStatus: "",
     };
     dialogVisible.value = true;
   });

+ 147 - 66
src/views/purchaseManage/purchaseManage/arrival/index.vue

@@ -12,13 +12,12 @@
         :table-events="{
           //element talbe事件都能传
           select: selectRow,
-          'select-all': selectRow,
         }"
         :action-list="[
           {
             text: '质检',
             disabled: selectData.length === 0,
-            action: () => start(),
+            action: () => start(20),
           },
         ]"
         @get-list="getList"
@@ -80,48 +79,54 @@
 
         <div style="margin-bottom: 10px; font-size: 14px">到货明细</div>
         <el-form-item>
-          <el-table :data="formData.data.purchaseDetailList">
+          <el-table :data="formData.data.qualityDetailList">
             <el-table-column
-              prop="goodType"
+              prop="productType"
               label="货品类型"
-              :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
+              :formatter="(row) => (row.productType == 1 ? '产品' : '物料')"
             />
             <el-table-column prop="productCode" label="货品编码" />
             <el-table-column prop="productName" label="货品名称" />
             <el-table-column prop="productSpec" label="规格型号" />
             <el-table-column prop="productUnit" label="单位" />
-            <el-table-column prop="productUnit" label="到货数量" />
-            <el-table-column prop="productUnit" label="已质检" />
-            <el-table-column prop="count" label="质检合格" min-width="150">
+            <el-table-column prop="count" label="到货数量" />
+            <el-table-column prop="sumQualityCount" label="已质检" />
+            <el-table-column
+              prop="qualifiedCount"
+              label="质检合格"
+              min-width="150"
+            >
               <template #default="{ row, $index }">
                 <el-form-item
-                  :prop="'purchaseDetailList.' + $index + '.count'"
-                  :rules="rules.count"
+                  :prop="'qualityDetailList.' + $index + '.qualifiedCount'"
+                  :rules="rules.qualifiedCount"
                   :inline-message="true"
                 >
                   <el-input-number
-                    v-model="row.count"
+                    v-model="row.qualifiedCount"
                     :precision="4"
                     :controls="false"
                     :min="0"
-                    @change="handleChangeAmount"
                   />
                 </el-form-item>
               </template>
             </el-table-column>
-            <el-table-column prop="count" label="质检不合格" min-width="150">
+            <el-table-column
+              prop="noQualifiedCount"
+              label="质检不合格"
+              min-width="150"
+            >
               <template #default="{ row, $index }">
                 <el-form-item
-                  :prop="'purchaseDetailList.' + $index + '.count'"
-                  :rules="rules.count"
+                  :prop="'qualityDetailList.' + $index + '.noQualifiedCount'"
+                  :rules="rules.noQualifiedCount"
                   :inline-message="true"
                 >
                   <el-input-number
-                    v-model="row.count"
+                    v-model="row.noQualifiedCount"
                     :precision="4"
                     :controls="false"
                     :min="0"
-                    @change="handleChangeAmount"
                   />
                 </el-form-item>
               </template>
@@ -150,7 +155,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import FileUpload from "@/components/FileUpload/index";
-import { computed, defineComponent, ref } from "vue";
+import { computed, defineComponent, ref, watch } from "vue";
 import { getToken } from "@/utils/auth";
 
 const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
@@ -171,20 +176,30 @@ let modalType = ref("add");
 let fileList = ref([]);
 let rules = ref({
   name: [{ required: true, message: "请输入供应商名称", trigger: "blur" }],
+  qualifiedCount: [
+    { required: true, message: "请输入质检合格数量", trigger: "blur" },
+  ],
+  noQualifiedCount: [
+    { required: true, message: "请输入质检不合格数量", trigger: "blur" },
+  ],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
   {
-    label: "申购状态",
-    prop: "type",
+    label: "质检状态",
+    prop: "status",
     data: [
       {
-        label: "产品",
-        value: "1",
+        label: "未质检",
+        value: "0",
+      },
+      {
+        label: "部分质检",
+        value: "10",
       },
       {
-        label: "物料",
-        value: "2",
+        label: "已质检",
+        value: "20",
       },
     ],
   },
@@ -194,76 +209,86 @@ const config = computed(() => {
     {
       type: "selection",
       attrs: {
-        label: "角色名称",
-        prop: "remark",
-        width: 50,
+        checkAtt: "isCheck",
       },
     },
     {
       attrs: {
         label: "到货单号",
-        prop: "name",
+        prop: "code",
       },
     },
     {
       attrs: {
         label: "供应商",
-        prop: "remarks",
+        prop: "supplyName",
       },
     },
     {
       attrs: {
         label: "物品类型",
-        prop: "remarks",
+        prop: "productType",
+      },
+      render(type) {
+        return type == 1 ? "产品" : type == 2 ? "物料" : "";
       },
     },
 
     {
       attrs: {
         label: "物品编码",
-        prop: "remarks",
+        prop: "productCode",
       },
     },
     {
       attrs: {
         label: "物品名称",
-        prop: "remarks",
+        prop: "productName",
       },
     },
     {
       attrs: {
         label: "规格型号",
-        prop: "remarks",
+        prop: "productSpec",
       },
     },
     {
       attrs: {
         label: "单位",
-        prop: "remarks",
+        prop: "productUnit",
       },
     },
     {
       attrs: {
         label: "到货数量",
-        prop: "remarks",
+        prop: "count",
       },
     },
     {
       attrs: {
         label: "质检合格",
-        prop: "remarks",
+        prop: "qualifiedCount",
       },
     },
     {
       attrs: {
         label: "质检不合格",
-        prop: "remarks",
+        prop: "noQualifiedCount",
       },
     },
     {
       attrs: {
         label: "质检状态",
-        prop: "remarks",
+        prop: "status",
+      },
+      render(type) {
+        return type == 0
+          ? "未质检"
+          : type == 10
+          ? "部分质检"
+          : type == 20
+          ? "已质检"
+          : "";
       },
     },
     {
@@ -280,11 +305,12 @@ const config = computed(() => {
               label: "质检",
               type: "primary",
               text: true,
+              disabled: row.status == 20,
             },
             el: "button",
             click() {
-              selectData.value = [row];
-              start();
+              selectDataOne.value = [row];
+              start(10);
             },
           },
         ];
@@ -309,9 +335,15 @@ const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
   proxy
-    .post("/subscribeDetail/page", sourceList.value.pagination)
+    .post("/arrivalDetail/page", sourceList.value.pagination)
     .then((message) => {
-      console.log(message);
+      message.rows.forEach((x) => {
+        if (x.status < 20) {
+          x.isCheck = true;
+        } else {
+          x.isCheck = false;
+        }
+      });
       sourceList.value.data = message.rows;
       sourceList.value.pagination.total = message.total;
       setTimeout(() => {
@@ -322,20 +354,37 @@ const getList = async (req) => {
 
 const submitForm = () => {
   formDom.value.validate((valid) => {
+    const list = formData.data.qualityDetailList;
+    for (let i = 0; i < list.length; i++) {
+      const e = list[i];
+      if (!(e.qualifiedCount + e.noQualifiedCount > 0)) {
+        return ElMessage({
+          message: "质检数量不能为0!",
+          type: "info",
+        });
+      }
+      if (
+        e.qualifiedCount + e.noQualifiedCount + Number(e.sumQualityCount) >
+        Number(e.count)
+      ) {
+        return ElMessage({
+          message: "质检数量不能大于到货数量!",
+          type: "info",
+        });
+      }
+    }
     submitLoading.value = true;
-    proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
+    proxy.post("/quality/" + modalType.value, formData.data).then(
       (res) => {
         ElMessage({
-          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          message: "质检成功",
           type: "success",
         });
-        fileList.value = [];
         dialogVisible.value = false;
         submitLoading.value = false;
         getList();
       },
       (err) => {
-        console.log(err, "aswwwww");
         submitLoading.value = false;
       }
     );
@@ -361,37 +410,69 @@ const getDtl = (row) => {
 
 getList();
 const selectData = ref([]);
+const selectDataOne = ref([]);
+
 const selectRow = (data) => {
   selectData.value = data;
 };
 
-const start = () => {
-  modalType.value = "edit";
-  dialogVisible.value = true;
-  // console.log(selectData.value.length, "22");
-  // if (selectData.value.length > 0) {
-  // } else {
-  //   return ElMessage({
-  //     message: "请勾选数据!",
-  //     type: "info",
-  //   });
-  // }
+const start = (type) => {
+  modalType.value = "add";
+  let ids = [];
+  let row = {};
+  if (type === 10) {
+    row = selectDataOne.value[0];
+    ids = selectDataOne.value.map((x) => x.id);
+  } else if (type === 20) {
+    ids = selectData.value.map((x) => x.id);
+    row = selectData.value[0];
+  }
+  proxy.post("/arrivalDetail/detail", { ids }).then((res) => {
+    formData.data = {
+      arrivalId: row.arrivalId,
+      supplyId: row.supplyId,
+      supplyName: row.supplyName,
+      code: row.code,
+      qualityDetailList: res.map((x) => ({
+        ...x,
+        arrivalDetailId: x.id,
+        qualifiedCount: 0,
+        noQualifiedCount: 0,
+      })),
+    };
+    dialogVisible.value = true;
+  });
 };
 
-// 获取供应商数据
-const supplierData = ref([]);
-const getSupplierList = async (req) => {
-  proxy
-    .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
-    .then((res) => {
-      supplierData.value = res.rows;
+watch(selectData, (newVal, oldVal) => {
+  if (newVal.length == 0) {
+    sourceList.value.data.forEach((x) => {
+      if (x.status < 20) {
+        x.isCheck = true;
+      } else {
+        x.isCheck = false;
+      }
     });
-};
-getSupplierList();
+  } else if (newVal.length == 1) {
+    const current = newVal[0];
+    sourceList.value.data.forEach((x) => {
+      if (x.arrivalId !== current.arrivalId || x.status == 20) {
+        x.isCheck = false;
+      }
+    });
+  }
+});
+
+onMounted(() => {});
 </script>
   
 <style lang="scss" scoped>
 .tenant {
   padding: 20px;
 }
+::deep {
+}
+.el-checkbox {
+  display: none;
+}
 </style>

+ 479 - 0
src/views/purchaseManage/purchaseManage/returnGoods/index.vue

@@ -0,0 +1,479 @@
+<template>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+        }"
+        :action-list="[
+          {
+            text: '添加退货',
+            action: () => start(),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #fileSlot="{ item }">
+          <div
+            style="cursor: pointer; color: #409eff"
+            @click="handleClickFile(item)"
+          >
+            {{ item.fileName }}
+          </div>
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      title="到货通知"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <el-form
+        :model="formData.data"
+        :rules="rules"
+        ref="formDom"
+        label-position="top"
+      >
+        <div style="margin-bottom: 10px; font-size: 14px">基础信息</div>
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="供应商" prop="supplyId">
+              <el-select
+                v-model="formData.data.supplyId"
+                placeholder="请选择"
+                style="width: 100%"
+                disabled
+              >
+                <el-option
+                  v-for="item in supplierData"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="6">
+            <el-form-item label="采购单号" prop="code">
+              <el-input
+                v-model="formData.data.code"
+                placeholder="请输入"
+                disabled
+              >
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <div style="margin-bottom: 10px; font-size: 14px">到货明细</div>
+        <el-form-item>
+          <el-table :data="formData.data.arrivalDetailList">
+            <el-table-column
+              prop="goodType"
+              label="货品类型"
+              :formatter="(row) => (row.goodType == 1 ? '产品' : '物料')"
+            />
+            <el-table-column prop="productCode" label="货品编码" />
+            <el-table-column prop="productName" label="货品名称" />
+            <el-table-column prop="productSpec" label="规格型号" />
+            <el-table-column prop="productUnit" label="单位" />
+            <el-table-column prop="purchaseCount" label="采购数量" />
+            <el-table-column prop="sumArrivalCount" label="已到货" />
+            <el-table-column prop="count" label="本次到货" min-width="150">
+              <template #default="{ row, $index }">
+                <el-form-item
+                  :prop="'arrivalDetailList.' + $index + '.count'"
+                  :rules="rules.count"
+                  :inline-message="true"
+                >
+                  <el-input-number
+                    v-model="row.count"
+                    :precision="4"
+                    :controls="false"
+                    :min="0"
+                    @change="handleChangeAmount"
+                  />
+                </el-form-item>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-form-item>
+      </el-form>
+
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm()"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  count: [{ required: true, message: "请输入本次到货", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  {
+    label: "退货状态",
+    prop: "status",
+    data: [
+      {
+        label: "审批中",
+        value: "10",
+      },
+      {
+        label: "驳回",
+        value: "20",
+      },
+      {
+        label: "待退货",
+        value: "30",
+      },
+    ],
+  },
+  {
+    label: "到货状态",
+    prop: "arrivalStatus",
+    data: [
+      {
+        label: "未到货",
+        value: "0",
+      },
+      {
+        label: "部分到货",
+        value: "10",
+      },
+      {
+        label: "已到货",
+        value: "20",
+      },
+    ],
+  },
+  {
+    label: "付款状态",
+    prop: "payStatus",
+    data: [
+      {
+        label: "未付款",
+        value: "1",
+      },
+      {
+        label: "部分付款",
+        value: "2",
+      },
+      {
+        label: "已付款",
+        value: "3",
+      },
+    ],
+  },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "退货单号",
+        prop: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "供应商",
+        prop: "supplyName",
+      },
+    },
+
+    {
+      attrs: {
+        label: "物品编码",
+        prop: "remarks",
+      },
+    },
+    {
+      attrs: {
+        label: "物品名称",
+        prop: "purchaseName",
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "createTime",
+      },
+    },
+    {
+      attrs: {
+        label: "退货数量",
+        prop: "purchaseStatus",
+      },
+    },
+    {
+      attrs: {
+        label: "退货状态",
+        prop: "arrivalStatus",
+      },
+    },
+    {
+      attrs: {
+        label: "退款状态",
+        prop: "payStatus",
+      },
+    },
+    {
+      attrs: {
+        label: "操作人",
+        prop: "payStatus",
+      },
+    },
+    {
+      attrs: {
+        label: "操作时间",
+        prop: "payStatus",
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "100",
+        align: "right",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "结束",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              handleEdit(row, 99);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {
+    type: "1",
+  },
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const formDom = ref(null);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "radio",
+      prop: "name",
+      label: "供应商类型",
+      required: true,
+      border: true,
+      data: [
+        { label: "贸易商", value: "1" },
+        { label: "工厂", value: "2" },
+      ],
+    },
+    {
+      type: "input",
+      prop: "name",
+      label: "供应商名称",
+      required: true,
+    },
+    {
+      type: "slot",
+      slotName: "address",
+      label: "地址",
+      required: true,
+    },
+    {
+      type: "slot",
+      slotName: "contact",
+      label: "联系信息",
+      required: true,
+    },
+    {
+      type: "slot",
+      slotName: "fileSlot",
+      label: "上传附件",
+    },
+    {
+      type: "input",
+      label: "备注",
+      prop: "remakes",
+      itemType: "textarea",
+    },
+  ];
+});
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/salesReturnDetail/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+
+const submitForm = async () => {
+  formDom.value.validate((vaild) => {
+    if (vaild) {
+      const list = formData.data.arrivalDetailList;
+      const total = list.reduce((total, x) => (total += Number(x.count)));
+      if (total < 1) {
+        return ElMessage({
+          message: `本次到货不能为0!`,
+          type: "info",
+        });
+      }
+      let sum = 0;
+      for (let i = 0; i < list.length; i++) {
+        const e = list[i];
+        if (
+          Number(e.sumArrivalCount) + Number(e.count) >=
+          Number(e.purchaseCount)
+        ) {
+          sum += 1;
+        }
+      }
+      formData.data.arrivalStatus = sum === list.length ? "20" : "10";
+      proxy.post("/arrival/add", formData.data).then((res) => {
+        ElMessage({
+          message: `操作成功!`,
+          type: "success",
+        });
+        dialogVisible.value = true;
+        getList();
+      });
+    }
+  });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
+    formData.data = res;
+    dialogVisible.value = true;
+  });
+};
+
+const handleEdit = (row, status) => {
+  let purchaseStatusName = status == 88 ? "作废" : "终止";
+  const data = { ...row, purchaseStatus: status };
+  // 弹窗提示是否删除
+  ElMessageBox.confirm(
+    `此操作将${purchaseStatusName}该数据, 是否继续?`,
+    "提示",
+    {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning",
+    }
+  ).then(() => {
+    // 删除
+    proxy
+      .post("/purchase/edit", {
+        data,
+      })
+      .then((res) => {
+        ElMessage({
+          message: `${purchaseStatusName}成功`,
+          type: "success",
+        });
+        getList();
+      });
+  });
+};
+
+// 获取供应商数据
+const supplierData = ref([]);
+const getSupplierList = async (req) => {
+  proxy
+    .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
+    .then((res) => {
+      supplierData.value = res.rows;
+    });
+};
+const handleArrival = (row) => {
+  proxy.post("/purchase/detail", { id: row.id }).then((res) => {
+    formData.data = {
+      purchaseId: row.id,
+      code: res.code,
+      supplyId: res.supplyId,
+      arrivalDetailList: res.purchaseDetailList.map((x) => ({
+        ...x,
+        purchaseDetailId: x.id,
+        purchaseCount: x.count,
+        count: 0,
+      })),
+      arrivalStatus: "",
+    };
+    dialogVisible.value = true;
+  });
+};
+
+getList();
+getSupplierList();
+const start = () => {
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      isSubscribe: "40",
+      ids: "",
+    },
+  });
+};
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>

+ 305 - 0
src/views/purchaseSales/warehouseConfig/warehouse/index.vue

@@ -0,0 +1,305 @@
+<template>
+  <div class="tenant">
+    <!-- <Banner /> -->
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: '添加仓库',
+            action: () => openModal('add'),
+          },
+        ]"
+        @get-list="getList"
+      >
+        <template #slotName="{ item }">
+          {{ item.createTime }}
+        </template>
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加仓库' : '编辑'"
+      v-model="dialogVisible"
+      width="800"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+  
+<script setup>
+/* eslint-disable vue/no-unused-components */
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import { computed, defineComponent, ref } from "vue";
+import useUserStore from "@/store/modules/user";
+
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let roomDialogVisible = ref(false);
+let modalType = ref("add");
+let rules = ref({
+  type: [
+    { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
+  ],
+  name: [{ required: true, message: "请输入仓库名称", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const selectConfig = reactive([
+  {
+    label: "仓库类型",
+    prop: "type",
+    data: [],
+  },
+]);
+
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "仓库名称",
+        prop: "name",
+      },
+    },
+    {
+      attrs: {
+        label: "仓库类型",
+        prop: "type",
+      },
+      render(type) {
+        return proxy.dictDataEcho(type, warehouseType.value);
+      },
+    },
+    {
+      attrs: {
+        label: "仓管员名称",
+        prop: "keeperName",
+      },
+    },
+    {
+      attrs: {
+        label: "备注",
+        prop: "remark",
+      },
+    },
+
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      // 渲染 el-button,一般用在最后一列。
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              // 弹窗提示是否删除
+              ElMessageBox.confirm(
+                "此操作将永久删除该数据, 是否继续?",
+                "提示",
+                {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning",
+                }
+              ).then(() => {
+                // 删除
+                proxy
+                  .post("/warehouse/delete", {
+                    id: row.id,
+                  })
+                  .then((res) => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+
+let formData = reactive({
+  data: {},
+  treeData: [],
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const treeData = ref([]);
+const formConfig = reactive([
+  {
+    type: "select",
+    prop: "type",
+    label: "仓库类型",
+    required: true,
+    data: [],
+  },
+  {
+    type: "input",
+    prop: "name",
+    label: "仓库名称",
+  },
+  {
+    type: "select",
+    prop: "keeperId",
+    label: "仓管员",
+    isLoad: {
+      url: `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
+        useUserStore().user.tenantId
+      }`,
+      labelKey: "nickName",
+      labelVal: "userId",
+      method: "get",
+      resUrl: "rows",
+    },
+  },
+  {
+    type: "input",
+    itemType: "textarea",
+    prop: "remark",
+    label: "备注",
+  },
+]);
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/warehouse/page", sourceList.value.pagination).then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {};
+};
+
+const submitForm = () => {
+  console.log(byform.value);
+  byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
+    proxy.post("/warehouse/" + modalType.value, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => (submitLoading.value = false)
+    );
+  });
+};
+
+const getDtl = (row) => {
+  modalType.value = "edit";
+  proxy.post("/warehouse/detail", { id: row.id }).then((res) => {
+    res.type = res.type + "";
+    formData.data = res;
+    console.log(formData);
+    dialogVisible.value = true;
+  });
+};
+const warehouseType = ref([]);
+const getDict = () => {
+  // // 币种数据
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      tenantId: useUserStore().user.tenantId,
+      dictCode: "warehouse_type",
+    })
+    .then((res) => {
+      warehouseType.value = res.rows;
+      selectConfig[0].data = res.rows.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+      formConfig[0].data = res.rows.map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+    });
+};
+getList();
+getDict();
+</script>
+  
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+</style>