|
@@ -0,0 +1,406 @@
|
|
|
+<!-- 批量新增 -->
|
|
|
+<script>
|
|
|
+import useColumns from "./column";
|
|
|
+import {addChangeList, getMaterialDetails, getChangeDetails, editChangeList} from '@/api/changeApply/basic';
|
|
|
+
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "AddChangeOrders",
|
|
|
+ props: {
|
|
|
+ dict: {
|
|
|
+ type: Object,
|
|
|
+ },
|
|
|
+ addType: {
|
|
|
+ type: String,
|
|
|
+ default: "add",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ ElSuperForm: () => import("@/components/super-form/index.vue"),
|
|
|
+ ElSuperTable: () => import("@/components/super-table/index.vue"),
|
|
|
+ ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
|
|
|
+ ElPopoverTreeSelect: () =>
|
|
|
+ import("@/components/popover-tree-select/index.vue"),
|
|
|
+ },
|
|
|
+
|
|
|
+ data() {
|
|
|
+
|
|
|
+ const {
|
|
|
+ TabColumns,
|
|
|
+ TableColumns,
|
|
|
+ TabColumns: [
|
|
|
+ {
|
|
|
+ item: { key: tabName },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ } = useColumns();
|
|
|
+
|
|
|
+ const rules = this.$init.rules([...TabColumns, ...TableColumns]);
|
|
|
+ const params = this.$init.params([...TabColumns, ...TableColumns]);
|
|
|
+ return {
|
|
|
+ width: "100%",
|
|
|
+ visible: false,
|
|
|
+ loading:false,
|
|
|
+ rules,
|
|
|
+ params,
|
|
|
+ tabName: tabName,
|
|
|
+ TabColumns: TabColumns,
|
|
|
+ TableColumns: TableColumns,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ title: {
|
|
|
+ get() {
|
|
|
+ const { addType } = this;
|
|
|
+ if (addType === "add") {
|
|
|
+ return "新 增";
|
|
|
+ }
|
|
|
+ if (addType === "edit") {
|
|
|
+ return "编 辑";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ set() {},
|
|
|
+ },
|
|
|
+ materialInfo:{
|
|
|
+ get(){
|
|
|
+ const { materialBasic } = this.params;
|
|
|
+ this.params.materialBasic = materialBasic.map((item, index) => ({
|
|
|
+ ...item,
|
|
|
+ $index: index,
|
|
|
+ }));
|
|
|
+
|
|
|
+ return {
|
|
|
+ materialBasic: this.params.materialBasic.filter(
|
|
|
+ ({ delFlag }) => delFlag !== "2"
|
|
|
+ ),
|
|
|
+ }
|
|
|
+ },
|
|
|
+ set(){},
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ setVisible(prop){
|
|
|
+ this.visible = prop;
|
|
|
+ },
|
|
|
+ beforeOpen(){
|
|
|
+ if(this.addType === 'add'){
|
|
|
+ this.params.orgIdName = '德荣集团';
|
|
|
+ this.useRowAdd(this.tabName);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //
|
|
|
+ changePuOrgName(prop) {
|
|
|
+
|
|
|
+ },
|
|
|
+ //
|
|
|
+ changeMaterialName(prop) {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ //
|
|
|
+ async fetchItem(prop) {
|
|
|
+ try {
|
|
|
+ // try
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ } catch (err) {
|
|
|
+ // catch
|
|
|
+ console.error(err);
|
|
|
+ } finally {
|
|
|
+ // finally
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //
|
|
|
+ async hide() {
|
|
|
+ const {
|
|
|
+ TabColumns,
|
|
|
+ TableColumns,
|
|
|
+ TabColumns: [
|
|
|
+ {
|
|
|
+ item: { key: tabName },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ } = useColumns();
|
|
|
+ this.visible = false;
|
|
|
+ this.tabName = tabName;
|
|
|
+ this.params = this.$init.params([...TabColumns, ...TableColumns]);
|
|
|
+ },
|
|
|
+ //
|
|
|
+ async useRowAdd(prop) {
|
|
|
+
|
|
|
+ const { TableColumns } = this.TabColumns.find(
|
|
|
+ ({ item: { key } }) => key === prop
|
|
|
+ );
|
|
|
+ this.params[prop].push({
|
|
|
+ delFlag: "0",
|
|
|
+ classifyId:null,
|
|
|
+ ...this.$init.params(TableColumns),
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //
|
|
|
+ async useRowRemove(prop, scope) {
|
|
|
+ const { addType } = this.$props;
|
|
|
+ const {
|
|
|
+ row: { $index },
|
|
|
+ } = scope;
|
|
|
+ if (addType === "add") {
|
|
|
+ this.params[prop].splice($index, 1);
|
|
|
+ }
|
|
|
+ if (addType === "edit") {
|
|
|
+ this.params[prop] = this.params[prop].map((item, index) => ({
|
|
|
+ ...item,
|
|
|
+ delFlag: index === $index ? "2" : item.delFlag,
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async amendantRecord(prop, scope){
|
|
|
+
|
|
|
+ },
|
|
|
+ handleSubmitValidate(prop,cb){
|
|
|
+
|
|
|
+ this.$refs[prop].$refs[prop].validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ try {
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ await cb();
|
|
|
+
|
|
|
+ } catch (err) {
|
|
|
+ // catch
|
|
|
+ console.error(err);
|
|
|
+ } finally {
|
|
|
+ // finally
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //
|
|
|
+ async useSubmit(prop) {
|
|
|
+ console.log(this.params,'this.params');
|
|
|
+ this.handleSubmitValidate(prop,async()=>{
|
|
|
+
|
|
|
+ const {code} = await addChangeList(this.params);
|
|
|
+
|
|
|
+ if(code == 200){
|
|
|
+
|
|
|
+ }
|
|
|
+ // await;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+ destroyed() {},
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <el-drawer
|
|
|
+ v-bind="$attrs"
|
|
|
+ v-on="$listeners"
|
|
|
+ :size="width"
|
|
|
+ :visible.sync="visible"
|
|
|
+ destroy-on-close
|
|
|
+ :show-close="false"
|
|
|
+ @close="hide"
|
|
|
+ @open="beforeOpen"
|
|
|
+ v-loading="loading"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ slot="title"
|
|
|
+ style="display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;"
|
|
|
+ >
|
|
|
+ <h3>{{title}}</h3>
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :size="$attrs.size"
|
|
|
+ :loading="loading"
|
|
|
+ @click="useSubmit('superForm')"
|
|
|
+ >确 认</el-button
|
|
|
+ >
|
|
|
+ <el-button :size="$attrs.size" :loading="loading" @click="hide"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-super-form
|
|
|
+ v-model="params"
|
|
|
+ :dict="dict"
|
|
|
+ :rules="rules"
|
|
|
+ :size="$attrs.size"
|
|
|
+ :columns="TableColumns"
|
|
|
+ ref="superForm"
|
|
|
+ label-width="auto"
|
|
|
+ label-position="right"
|
|
|
+ style="padding: 20px"
|
|
|
+ >
|
|
|
+ <template slot="puOrgName" slot-scope="scope">
|
|
|
+ <component
|
|
|
+ v-bind="scope.attr"
|
|
|
+ v-model="scope.row[scope.item.key]"
|
|
|
+ :size="$attrs.size"
|
|
|
+ :source.sync="scope.row"
|
|
|
+ @change="changePuOrgName({ ...scope, select: $event })"
|
|
|
+ >
|
|
|
+ </component
|
|
|
+ ></template>
|
|
|
+ </el-super-form>
|
|
|
+
|
|
|
+
|
|
|
+ <el-tabs v-model="tabName" style="padding: 0 20px 20px">
|
|
|
+ <el-tab-pane
|
|
|
+ v-for="({ item, TableColumns: columns }, index) in TabColumns"
|
|
|
+ :key="index"
|
|
|
+ :label="item.title"
|
|
|
+ :name="item.key"
|
|
|
+ lazy
|
|
|
+ >
|
|
|
+ <el-super-table
|
|
|
+ v-model="materialInfo[item.key]"
|
|
|
+ :dict="dict"
|
|
|
+ :ref="tabName"
|
|
|
+ :columns="columns"
|
|
|
+ :size="$attrs.size"
|
|
|
+ >
|
|
|
+ <template slot="materialName" slot-scope="scope">
|
|
|
+ <component
|
|
|
+ v-bind="scope.attr"
|
|
|
+ v-model="scope.row[scope.item.key]"
|
|
|
+ :size="$attrs.size"
|
|
|
+ :source.sync="scope.row"
|
|
|
+ @change="changeMaterialName(scope)"
|
|
|
+ >
|
|
|
+ </component>
|
|
|
+ </template>
|
|
|
+ <!-- 判断是否禁用 -->
|
|
|
+ <template slot="drug" slot-scope="scope">
|
|
|
+ <component
|
|
|
+ v-bind="scope.attr"
|
|
|
+ v-model="scope.row[scope.item.key]"
|
|
|
+ :size="$attrs.size"
|
|
|
+ :source.sync="scope.row"
|
|
|
+ :disabled="!(scope.row.medicineMaterial ==='0') "
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in dict.type[scope.attr.dictName]"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </component>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot="registrationNo" slot-scope="scope">
|
|
|
+ <component
|
|
|
+ v-bind="scope.attr"
|
|
|
+ v-model="scope.row[scope.item.key]"
|
|
|
+ :size="$attrs.size"
|
|
|
+ :source.sync="scope.row"
|
|
|
+ :disabled="!(scope.row.medicineMaterial ==='0') "
|
|
|
+ @change="changeMaterialName(scope)"
|
|
|
+ >
|
|
|
+ </component>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot="medicalDevices" slot-scope="scope">
|
|
|
+ <component
|
|
|
+ v-bind="scope.attr"
|
|
|
+ v-model="scope.row[scope.item.key]"
|
|
|
+ :size="$attrs.size"
|
|
|
+ :source.sync="scope.row"
|
|
|
+ :disabled="!(scope.row.medicineMaterial ==='0') "
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in dict.type[scope.attr.dictName]"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </component>
|
|
|
+ </template>
|
|
|
+ <template slot="maintenanceType" slot-scope="scope">
|
|
|
+ <component
|
|
|
+ v-bind="scope.attr"
|
|
|
+ v-model="scope.row[scope.item.key]"
|
|
|
+ :size="$attrs.size"
|
|
|
+ :source.sync="scope.row"
|
|
|
+ :disabled="!(scope.row.medicineMaterial ==='0') "
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in dict.type[scope.attr.dictName]"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </component>
|
|
|
+ </template>
|
|
|
+ <template slot="dosageFromName" slot-scope="scope">
|
|
|
+ <component
|
|
|
+ v-bind="scope.attr"
|
|
|
+ v-model="scope.row[scope.item.key]"
|
|
|
+ :size="$attrs.size"
|
|
|
+ :source.sync="scope.row"
|
|
|
+ :disabled="!(scope.row.medicineMaterial ==='0') "
|
|
|
+ >
|
|
|
+ </component>
|
|
|
+ </template>
|
|
|
+
|
|
|
+
|
|
|
+ <el-table-column fixed="right" label="操作" width="120" align="center">
|
|
|
+ <template slot="header" slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ :size="$attrs.size"
|
|
|
+ @click="useRowAdd(tabName)"
|
|
|
+ >
|
|
|
+ 增行
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ :size="$attrs.size"
|
|
|
+ @click.native.prevent="useRowRemove(tabName, scope)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-if=" tabName ==='materialBasic' "
|
|
|
+ type="text"
|
|
|
+ :size="$attrs.size"
|
|
|
+ @click.native.prevent="amendantRecord(tabName, scope)"
|
|
|
+ >
|
|
|
+ 修改记录
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-super-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+
|
|
|
+ </el-drawer>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+::v-deep .el-table__row.is-hidden {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+
|