Explorar el Código

feat: 报告管理

32197351@qq.com hace 2 años
padre
commit
ad2b2d707c

+ 205 - 0
itdmWeb/src/views/module-iTDM/baogao/ItdmBaogaoList.vue

@@ -0,0 +1,205 @@
+<template>
+  <a-card :bordered="false">
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-row :gutter="24">
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 查询区域-END -->
+
+    <!-- 操作按钮区域 -->
+    <div class="table-operator">
+      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
+
+      <a-dropdown v-if="selectedRowKeys.length > 0">
+        <a-menu slot="overlay">
+          <a-menu-item key="1" @click="batchDel">
+            <a-icon type="delete" />
+            删除
+          </a-menu-item>
+        </a-menu>
+        <a-button style="margin-left: 8px"> 批量操作
+          <a-icon type="down" />
+        </a-button>
+      </a-dropdown>
+    </div>
+
+    <!-- table区域-begin -->
+    <div>
+      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
+        style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
+        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
+      </div>
+
+      <a-table
+        ref="table"
+        size="middle"
+        :scroll="{x:true}"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+        class="j-table-force-nowrap"
+        @change="handleTableChange">
+
+        <template slot="htmlSlot" slot-scope="text">
+          <div v-html="text"></div>
+        </template>
+        <template slot="imgSlot" slot-scope="text,record">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
+          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
+               style="max-width:80px;font-size: 12px;font-style: italic;" />
+        </template>
+        <template slot="fileSlot" slot-scope="text">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
+          <a-button
+            v-else
+            :ghost="true"
+            type="primary"
+            icon="download"
+            size="small"
+            @click="downloadFile(text)">
+            下载
+          </a-button>
+        </template>
+
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleEdit(record)">编辑</a>
+
+          <a-divider type="vertical" />
+          <a-dropdown>
+            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a @click="handleDetail(record)">详情</a>
+              </a-menu-item>
+              <a-menu-item>
+                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
+                  <a>删除</a>
+                </a-popconfirm>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown>
+        </span>
+
+      </a-table>
+    </div>
+
+    <itdm-baogao-modal ref="modalForm" @ok="modalFormOk"></itdm-baogao-modal>
+  </a-card>
+</template>
+
+<script>
+
+import '@/assets/less/TableExpand.less'
+import { mixinDevice } from '@/utils/mixin'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import ItdmBaogaoModal from './modules/ItdmBaogaoModal'
+import { filterMultiDictText } from '@comp/dict/JDictSelectUtil'
+import { getAction } from '@api/manage'
+
+export default {
+  name: 'ItdmBaogaoList',
+  mixins: [JeecgListMixin, mixinDevice],
+  components: {
+    ItdmBaogaoModal
+  },
+  data() {
+    return {
+      description: '报告生成管理页面',
+      // 表头
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key: 'rowIndex',
+          width: 60,
+          align: 'center',
+          customRender: function(t, r, index) {
+            return parseInt(index) + 1
+          }
+        },
+        {
+          title: '委托编号',
+          align: 'center',
+          dataIndex: 'weituoNo'
+        },
+
+        {
+          title: '委托单位名称',
+          align: 'center',
+          dataIndex: 'weituoClient'
+        },
+
+        {
+          title: '委托联系人',
+          align: 'center',
+          dataIndex: 'weituoLxr'
+        },
+
+        {
+          title: '报告模板',
+          align: 'center',
+          dataIndex: 'baogaoTypeName',
+
+        },
+        {
+          title: '报告文件地址',
+          align: 'center',
+          dataIndex: 'filePath'
+        },
+        {
+          title: '操作',
+          dataIndex: 'action',
+          align: 'center',
+          fixed: 'right',
+          width: 147,
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      url: {
+        list: '/baogao/itdmBaogao/list',
+        delete: '/baogao/itdmBaogao/delete',
+        deleteBatch: '/baogao/itdmBaogao/deleteBatch',
+        exportXlsUrl: '/baogao/itdmBaogao/exportXls',
+        importExcelUrl: 'baogao/itdmBaogao/importExcel'
+
+      },
+      dictOptions: {},
+      superFieldList: []
+    }
+  },
+  created() {
+    this.getSuperFieldList()
+    this.init()
+  },
+  computed: {
+    importExcelUrl: function() {
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
+    }
+  },
+  methods: {
+
+    getSuperFieldList() {
+      let fieldList = []
+      fieldList.push({ type: 'string', value: 'weituoNo', text: '委托编号', dictCode: '' })
+      fieldList.push({ type: 'string', value: 'weituoClient', text: '委托单位名称', dictCode: '' })
+      fieldList.push({ type: 'string', value: 'sampleNames', text: '委托样品列表', dictCode: '' })
+      fieldList.push({ type: 'string', value: 'weituoLxr', text: '委托联系人', dictCode: '' })
+      fieldList.push({ type: 'string', value: 'testItemsNames', text: '委托样品检测列表', dictCode: '' })
+      fieldList.push({ type: 'string', value: 'baogaoTypeName', text: '报告模板', dictCode: '' })
+      fieldList.push({ type: 'Text', value: 'filePath', text: '报告文件地址', dictCode: '' })
+      this.superFieldList = fieldList
+    }
+  }
+}
+</script>
+<style scoped>
+@import '~@assets/less/common.less';
+</style>

+ 272 - 0
itdmWeb/src/views/module-iTDM/baogao/modules/ItdmBaogaoForm.vue

@@ -0,0 +1,272 @@
+<template>
+  <a-spin :spinning="confirmLoading">
+    <j-form-container :disabled="formDisabled">
+      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
+        <a-row>
+
+          <a-col :span="24">
+            <a-form-model-item label="委托信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="weituoId">
+
+
+              <a-select
+                show-search
+                v-model="model.weituoId"
+                placeholder="请选择"
+                :default-active-first-option="false"
+                :show-arrow="false"
+                :filter-option="false"
+                :not-found-content="null"
+                @change="handleChange"
+              >
+                <a-select-option v-for="d in weituoDictOptions" :key="d.value">
+                  {{ d.text }}
+                </a-select-option>
+              </a-select>
+            </a-form-model-item>
+          </a-col>
+
+          <a-col :span="24">
+            <a-form-model-item label="委托样品" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sampleIds">
+              <a-select
+                show-search
+
+                mode="multiple"
+                v-model="model.sampleIds"
+                placeholder="请选择"
+                :default-active-first-option="false"
+                :show-arrow="false"
+                :filter-option="false"
+                :not-found-content="null"
+                @change="handleYPChange"
+
+              >
+                <a-select-option v-for="d in yangppinDictOptions" :key="d.value">
+                  {{ d.text }}
+                </a-select-option>
+              </a-select>
+            </a-form-model-item>
+
+          </a-col>
+
+          <a-col :span="24">
+            <a-form-model-item label="委托样品检测项目" :labelCol="labelCol" :wrapperCol="wrapperCol"
+                               prop="testItemsIds">
+              <a-select
+                show-search
+                mode="multiple"
+                v-model="model.testItemsIds"
+                placeholder="请选择"
+                :default-active-first-option="false"
+                :show-arrow="false"
+                :filter-option="false"
+                :not-found-content="null"
+
+
+              >
+                <a-select-option v-for="d in yangppinLsDictOptions" :key="d.value">
+                  {{ d.text }}
+                </a-select-option>
+              </a-select>
+            </a-form-model-item>
+          </a-col>
+
+          <a-col :span="24">
+            <a-form-model-item label="报告类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="baogaoType">
+
+              <j-search-select-tag v-model="model.baogaoType" dict="itdm_moban,name,id"  />
+
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="温度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="wendu">
+              <a-input v-model="model.wendu" placeholder="请输入温度"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="湿度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shidu">
+              <a-input v-model="model.shidu" placeholder="请输入湿度"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="大气压" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="daqiya">
+              <a-input v-model="model.daqiya" placeholder="请输入大气压"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+
+        </a-row>
+      </a-form-model>
+    </j-form-container>
+  </a-spin>
+</template>
+
+<script>
+
+import { httpAction, getAction } from '@/api/manage'
+import { validateDuplicateValue } from '@/utils/util'
+
+export default {
+  name: 'ItdmBaogaoForm',
+  components: {},
+  props: {
+    //表单禁用
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false
+    }
+  },
+  data() {
+    return {
+      yangppinLsDictOptions:[],
+      weituoDictOptions: [],
+      yangppinDictOptions: [],
+      model: {},
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 }
+      },
+      confirmLoading: false,
+      validatorRules: {
+        weituoId: [
+          { required: true, message: '请输入委托id!' }
+        ],
+        sampleIds: [
+          { required: true, message: '请输入委托样品id列表!' }
+        ],
+        testItemsIds: [
+          { required: true, message: '请输入委托样品检测Id列表!' }
+        ],
+        baogaoType: [
+          { required: true, message: '请输入报告类型!' }
+        ]
+      },
+      url: {
+        add: '/baogao/itdmBaogao/add',
+        edit: '/baogao/itdmBaogao/edit',
+        queryById: '/baogao/itdmBaogao/queryById'
+      }
+    }
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled
+    }
+  },
+  created() {
+    this.load()
+    //备份model原始值
+    this.modelDefault = JSON.parse(JSON.stringify(this.model))
+  },
+  methods: {
+    load() {
+      const select = {}
+      getAction('/baogao/itdmBaogao//weituo/list', select).then((res) => {
+        if (res.success) {
+          this.weituoDictOptions = res.result.map(i => {
+            const map = {}
+            map.text = i.weituoNo
+            map.value = i.id
+            return map
+          })
+          console.log(this.weituoDictOptions)
+
+        } else {
+          this.$message.warning(res.message)
+        }
+      })
+    },
+
+
+
+
+    yangpmList(weituoId) {
+      const select = { weituoId: weituoId }
+      getAction('/baogao/itdmBaogao/yangpin/list', select).then((res) => {
+        if (res.success) {
+          this.yangppinDictOptions = res.result.map(i => {
+            const map = {}
+            map.text = i.sampleName
+            map.value = i.id
+            return map
+          })
+          console.log(this.weituoDictOptions)
+
+        } else {
+          this.$message.warning(res.message)
+        }
+      })
+    },
+
+
+    queryShiyanList(yangpinIds) {
+      const select = { 'yangpinIds': yangpinIds.toString() }
+      getAction('/baogao/itdmBaogao/shiyan/list', select).then((res) => {
+        if (res.success) {
+          this.yangppinLsDictOptions = res.result.map(i => {
+            const map = {}
+            map.text = i.testItems
+            map.value = i.id
+            return map
+          })
+
+
+        } else {
+          this.$message.warning(res.message)
+        }
+      })
+    },
+
+    handleYPChange(value){
+      console.log(value)
+      this.queryShiyanList(value)
+    },
+    handleChange(value) {
+      console.log(value)
+      this.yangpmList(value)
+
+      // this.value = value
+      // fetch(value, data => (this.data = data))
+    },
+    add() {
+      this.edit(this.modelDefault)
+    },
+    edit(record) {
+      this.model = Object.assign({}, record)
+      this.visible = true
+    },
+    submitForm() {
+      const that = this
+      // 触发表单验证
+      this.$refs.form.validate(valid => {
+        if (valid) {
+          that.confirmLoading = true
+          let httpurl = ''
+          let method = ''
+          if (!this.model.id) {
+            httpurl += this.url.add
+            method = 'post'
+          } else {
+            httpurl += this.url.edit
+            method = 'put'
+          }
+          httpAction(httpurl, this.model, method).then((res) => {
+            if (res.success) {
+              that.$message.success(res.message)
+              that.$emit('ok')
+            } else {
+              that.$message.warning(res.message)
+            }
+          }).finally(() => {
+            that.confirmLoading = false
+          })
+        }
+
+      })
+    }
+  }
+}
+</script>

+ 84 - 0
itdmWeb/src/views/module-iTDM/baogao/modules/ItdmBaogaoModal.Style#Drawer.vue

@@ -0,0 +1,84 @@
+<template>
+  <a-drawer
+    :title="title"
+    :width="width"
+    placement="right"
+    :closable="false"
+    @close="close"
+    destroyOnClose
+    :visible="visible">
+    <itdm-baogao-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></itdm-baogao-form>
+    <div class="drawer-footer">
+      <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
+      <a-button v-if="!disableSubmit"  @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
+    </div>
+  </a-drawer>
+</template>
+
+<script>
+
+  import ItdmBaogaoForm from './ItdmBaogaoForm'
+
+  export default {
+    name: 'ItdmBaogaoModal',
+    components: {
+      ItdmBaogaoForm
+    },
+    data () {
+      return {
+        title:"操作",
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add () {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add();
+        })
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.edit(record);
+        });
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.realForm.submitForm();
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+/** Button按钮间距 */
+  .ant-btn {
+    margin-left: 30px;
+    margin-bottom: 30px;
+    float: right;
+  }
+  .drawer-footer{
+    position: absolute;
+    bottom: -8px;
+    width: 100%;
+    border-top: 1px solid #e8e8e8;
+    padding: 10px 16px;
+    text-align: right;
+    left: 0;
+    background: #fff;
+    border-radius: 0 0 2px 2px;
+  }
+</style>

+ 60 - 0
itdmWeb/src/views/module-iTDM/baogao/modules/ItdmBaogaoModal.vue

@@ -0,0 +1,60 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    switchFullscreen
+    @ok="handleOk"
+    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
+    @cancel="handleCancel"
+    cancelText="关闭">
+    <itdm-baogao-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></itdm-baogao-form>
+  </j-modal>
+</template>
+
+<script>
+
+  import ItdmBaogaoForm from './ItdmBaogaoForm'
+  export default {
+    name: 'ItdmBaogaoModal',
+    components: {
+      ItdmBaogaoForm
+    },
+    data () {
+      return {
+        title:'',
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add () {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add();
+        })
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.edit(record);
+        })
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.realForm.submitForm();
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>

+ 1 - 1
itdmWeb/src/views/module-iTDM/moban/modules/ItdmMobanForm.vue

@@ -15,7 +15,7 @@
           </a-col>
           <a-col :span="24">
             <a-form-model-item label="模板地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="filePath">
-              <j-upload v-model="model.filePath"   ></j-upload>
+              <j-upload v-model="model.filePath" :number="1"  :multiple="false"  ></j-upload>
             </a-form-model-item>
           </a-col>
         </a-row>